The program given below will test your understanding about the Wrapping classes and parsing object value using wrapper classes in Java.
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
(3)