Share on Google+Share on Google+

SCJP Module-6 Question-25

Advertisement
The program given below will test your understanding about the Wrapping classes and parsing object value using wrapper classes in Java.

Given below the sample code :

class ObjectClass {
public static void main(String args[]) {
Object[] ObjectsPack = { new Integer(12), new String("zoo"),
new Integer(5), new Boolean(true) };
Arrays.sort(ObjectsPack);
for (int i = 0; i < ObjectsPack.length; i++) {
System.out.print(ObjectsPack[i].toString());
System.out.print(" ");
}
}
}

What will be the output of the following code ?

1. 12  zoo  5 

2. 12  zoo  5  true

3.compilation error.

4.No output

Answer

(3)

Advertisements

Posted on: July 15, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.