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 / kumar

The above scenario using Wrapper class.The Wrapper class
allows arthmetic opertion(Boxing and unboxing the interget
numbers).So the result will be "three"

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Add a value x to array from index l to r where 0 <= l <= r <= n-1

633


Is arraylist a class in java?

536


What are multiple inheritances?

585


What is blank final variable?

566


What is jvm? Why is java called the platform independent programming language?

545






Are private methods final?

488


How do you define a variable?

538


Can we use static class instead of singleton?

580


What is difference between equals and hashcode method?

572


How many classes can any class inherit java?

510


Where is the singleton class used?

585


What are the ways in which a thread can enter the waiting state?

515


What if constructor is protected in java?

559


How do you sort words in java?

536


What do you mean by byte code?

515