Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Please explain. Boolean[] b1 = new Boolean[10]; Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply locked New topic
Author

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

Mr Iftikhar
Ranch Hand

Joined: Oct 12, 2001
Posts: 39
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.

java language
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
posting twice the same question is baaaaad
------------------
Valentin Crettaz
Sun Certified Programmer for Java 2 Platform


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Please explain. Boolean[] b1 = new Boolean[10];
 
Similar Threads
Logical operators precedence
Boolean
Object Ref
wrapper class doubt
Please explain. Boolean[] b1 = new Boolean[10];