Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dharmesh Rathod (Info)

 
Dharmesh Rathod
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(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
Posts: 3141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic