wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Dharmesh Rathod (Info) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Dharmesh Rathod (Info)" Watch "Dharmesh Rathod (Info)" New topic
Author

Dharmesh Rathod (Info)

Dharmesh Rathod
Greenhorn

Joined: Sep 21, 2000
Posts: 7
(1)In one mock exam i found following.
int anar[] = new int[] {1,2,3} ; saying that this line will give compile error , but it is working nicely. As a solution to this error what was said is following.
int anar[3] = new int[] {1,2,3} ; But the solution itself is not working.
(2) In the book of JAVA programming by E. Balaguruswami some model questions are given but so many answers are wrong.
Dharmesh Rathod.
Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
Hi Dharmesh,
The solution given in (1) is definitely wrong. To initialize arrays you can do one of the following:

You cannot do

Hope that helps.


Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dharmesh Rathod (Info)
 
Similar Threads
array!
mock exam question
doubt(marcus mock test)
what difference does it make ...arrayini
Initialization of Local Arrays