This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Bonus Master Exam

 
Jemima Job
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This question in the bonus Master Exam for K&B book, I don't think the answer selected as correct is true, because I compiled successfully but during runtime it threw nullpointerexception.
1. long a1[][];
2. long []a2[];
3. a2 = new long[3][];
4. a1 = a2;
5. System.out.println(a1[1][0]);

Selected answer is

Compilation fails at line 4.
 
Marlene Miller
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jemima. The second exam has this one error. Here are some comments by other people. Here
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic