This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes array problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "array problem" Watch "array problem" New topic

array problem

Venkata Raaman
Ranch Hand

Joined: Mar 26, 2010
Posts: 46

What is wrong with my code why am I getting warning..

Tom Reilly

Joined: Jun 01, 2010
Posts: 618
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:
Sunny Bhandari
Ranch Hand

Joined: Dec 06, 2010
Posts: 448

or make the array variable as static and move the erroneous code to main method.

Java Experience
I agree. Here's the link:
subject: array problem