File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Dharmesh Rathod (Info)" Watch "Dharmesh Rathod (Info)" New topic

Dharmesh Rathod (Info)

Dharmesh Rathod

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:
subject: Dharmesh Rathod (Info)
It's not a secret anymore!