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+2;

the answer is 1) three

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a static class in java?

556


What is re-factoring in software?

576


How do I convert a string to an int in java?

552


Which is a valid identifier?

546


How do you compare two strings lexicographically?

538






How many digits is int32?

537


What is lastindexof in java?

548


What is package private scope in java?

535


What is number data type?

532


What does singleton mean in java?

508


Can we pass a primitive type by reference in java? How

532


What is anagram word?

521


What is jit and its use?

585


What is meant by javabeans?

616


Why deletion in linkedlist is fast than arraylist?

535