Friday, September 4, 2009

SCJP Questions

Given:
1 public class foo {
2 public static void main (String[]args) {
3 String s;
4 system.out.printIn ("s=" + s);
5 }
6 }
What is the result?
A. The code compiles and "s=" is printed.
B. The code compiles and "s=null" is printed.
C. The code does not compile because string s is not initialized.
D. The code does not compile because string s cannot be referenced.
E. The code compiles, but a NullPointerException is thrown when toString is called.
Answer: C

0 comments:

Post a Comment

 

About

Site Info

Information Source

Academy of JAVA by Rajesh Rolen Copyright © 2009 Community is Developed by Rajesh Kumar Rolen WebSite

/* tracking code by yahoo login */