Results 1 to 6 of 6
Thread: Question - I'm a noob!
- 08-03-2008, 07:43 AM #1
Member
- Join Date
- Aug 2008
- Posts
- 2
- Rep Power
- 0
- 08-03-2008, 07:46 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
In the method you need two dimensional array. But your arguments are just an int values. That's why compiler complain it.
- 08-03-2008, 07:49 AM #3
Member
- Join Date
- Aug 2008
- Posts
- 2
- Rep Power
- 0
I'm sorry I didn't get you. Isn't that how you enter data for a two dimensional array as well, within curly brackets?
(PS: I apologize at my ignorance, this is my first attempt with Arrays)
- 08-03-2008, 07:55 AM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
No, defining a 2D array is as follows.
Basically what we called is that 2D array is an array of arrays. That's mean each array element holds another array.Java Code:int temp[][] = new int[3][3];
like this,
Is that clear?Java Code:temp[0] = {1, 2, 3}; temp[1] = {10, 20, 30}; temp[2] = {100, 200, 300};
- 08-03-2008, 01:47 PM #5
Or do it all in the declare/define statement:
int[][] twoDim = new int[][] {{1, 3}, {3, 5,7}};
- 08-04-2008, 03:20 AM #6
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Yep, define an array in anonymous way as Norm mentioned. In that way no need to give the size of the array in declaration.
Similar Threads
-
Noob
By nokomis in forum IntroductionsReplies: 2Last Post: 03-06-2009, 05:10 PM -
Please help a noob :)
By Bays in forum New To JavaReplies: 15Last Post: 06-17-2008, 06:11 AM -
Noob question- easy
By mattonitto in forum New To JavaReplies: 7Last Post: 06-13-2008, 12:26 AM -
[noob]Problem with TOS .bat
By fred33 in forum Advanced JavaReplies: 0Last Post: 03-19-2008, 02:04 PM -
Ah! Help a Java Noob
By Snejana in forum New To JavaReplies: 4Last Post: 01-24-2008, 03:52 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks