Results 1 to 2 of 2
Thread: passing an array as argument
- 02-29-2012, 03:00 PM #1
Member
- Join Date
- Nov 2011
- Posts
- 3
- Rep Power
- 0
passing an array as argument
i have a subclass that needs to call the constructor of it's superclass, so I use the "super()" method.
however, the superclass has an array as one of it's parameters. so i first tried this:
but this does not work, since super() needs to be the first instruction of the constructor.Java Code:int[] array = {1,2,3,4}; super(array);
does anyone know how to use an array as argument without initializing it in another line?
- 02-29-2012, 03:10 PM #2
Re: passing an array as argument
super(new int[]{1, 2, 3, 4});
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
Similar Threads
-
Variable argument lengths passing by reference issues
By Himetic in forum New To JavaReplies: 1Last Post: 02-28-2012, 10:34 AM -
Passing method as argument
By susieferrari in forum New To JavaReplies: 26Last Post: 06-13-2011, 10:43 AM -
N dimensional array as argument?
By foota in forum Advanced JavaReplies: 16Last Post: 05-07-2011, 09:55 AM -
passing a .txt into an array
By j_rod722 in forum New To JavaReplies: 6Last Post: 02-07-2011, 11:45 PM -
Passing a 2D array
By toymachiner62 in forum New To JavaReplies: 6Last Post: 10-23-2009, 04:05 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks