Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCPJP
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Liutauras Vilda
Paul Clapham
Sheriffs:
paul wheaton
Tim Cooke
Henry Wong
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Piet Souris
Bartenders:
Mike London
Forum:
Programmer Certification (OCPJP)
array problem
Venkata Raaman
Ranch Hand
Posts: 50
I like...
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
What is wrong with my code why am I getting warning..
public class My2DArray { int [] [] my2Darr= new int[5][];//the first one has to be filled which is base array my2Darr[0]= new int[3];//warning-cannot find symbol // symbol: class my2Darr //location: class scjpchp3.My2DArray //']' expected //']' expected public static void main(String[]args){ } }
Tom Reilly
Rancher
Posts: 618
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
You cannot just put a statement like my2Darr[0]= new int[3]; in a class. You have to put it in a method, constructor, or block of code. To see this, the easiest thing to do is put the statement in a code block as in:
{ my2Darr[0]= new int[3]; }
Sunny Bhandari
Ranch Hand
Posts: 448
I like...
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
or make the array variable as static and move the erroneous code to main method.
Java Experience
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
?
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
array issues
method overloading and passed arguments
A Quadrilateral extend program
Autoboxing, checking is two objects refer to the same object
What is wrong with my code?
More...