Given:
11. public static void main(String[] args) {
12. Integer i = uew Integer(1) + new Integer(2);
13. switch(i) {
14. case 3: System.out.println(”three”); break;
15. default: System.out.println(”other”); break;
16. }
17. }
‘What is the result?
1 three
2 other
3 An exception is thrown at runtime.
4 Compilation fails because of an error on
line 12.

Answer Posted / manikandan

In the line 12 .jus think new Integer(1) will result 1 and
new Integer(2) will result 2 so 1+2=3 which is stored in a i.

so the line 12 can b written as a Integer i=1+3;

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many static init can you have?

682


why an outer class cannot be declared as private?

3614


What is the purpose of interface?

583


Why is it important to initialize a variable?

491


worst case complexities of Quick sort and Merge sort.

605






Why do you canvas?

613


Difference between a class and an object?

578


What is increment in java?

526


What is a nullable field?

579


What are the restrictions that are applied to the java static methods?

532


Is finalize() similar to a destructor?

551


Why java is platform independent? Explain.

601


You can create a string object as string str = “abc”; why cant a button object be created as button bt = “abc”;? Explain

534


What is callablestatement? How you can call stored procedure to pass in parameter?

542


Should database connections be singleton?

570