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
How you can force the garbage collection?
What is final keyword?
Give few difference between constructor and method?
Which collection is ordered in java?
What is the purpose of default constructor?
If a method is declared as protected, where may the method be accessed?
What do you mean by global variable?
What is the finalize method do?
Can we write method inside a method in java?
What is null data type?
What is the use of a copy constructor?
How does queue work in java?
Does garbage collection occur in permanent generation space in jvm?
What are the differences between heap and stack memory in java?
What is google full form?