Win a copy of The Java Performance Companion this week in the Performance forum!
    Bookmark Topic Watch Topic
  • New Topic

Please explain. Boolean[] b1 = new Boolean[10];

 
Mr Iftikhar
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Report post to moderator
What will happen if run the following code?
1: Boolean[] b1 = new Boolean[10];
2:
3: boolean[] b2 = new boolean[10];
4:
5: System.out.println("The value of b1[1] = " +b1[1]);
6: System.out.println("The value of b2[1] = " +b2[1]);
A) Prints The value of b1[1] = false
The value of b2[1] = false
B) Prints The value of b1[1] = null
The value of b2[1] = null
C) Prints The value of b1[1] = null
The value of b2[1] = false
D) Prints The value of b1[1] = false
The value of b2[1] = null
The answer is C .
please explain why answer is C . I think this is wrong.
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Report post to moderator
posting twice the same question is baaaaad
------------------
Valentin Crettaz
Sun Certified Programmer for Java 2 Platform
 
    Bookmark Topic Watch Topic
  • New Topic