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

Why is stringbuffer not immutable?

576


What is the flag in java?

617


Which of the following classes will have more memory allocated?

589


What is entry set in java?

545


What are methods and how are they defined?

609






Is a string literal?

529


What is unicode used for?

584


Are floats faster than doubles?

576


What does localhost mean?

506


what type of questions asked for barclays technologies pune please send urgent

5241


What exceptions occur during serialization?

621


Who is the owner of java?

549


What is the final keyword denotes?

689


Are variables stored in ram?

562


What is the difference between static and non-static variables in java programming?

530