aspose file tools*
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 Spring in Action this week in the Spring 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Dharmesh Rathod (Info)