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
What is the difference between jvm and jre? What is an interface?
What is meant by design patterns?
When is update method called?
Is this valid in java ? Can we instantiate interface in java?
What's the base class of all exception classes?
What things should be kept in mind while creating your own exceptions in java?
What is the difference between delete and delete[]
What is data type example?
What is a Null object?
Is null an object java?
What happens if constructor is private?
How do you write a conditional statement?
What is output buffer?
Where is stringbuffer stored?
What is the purpose of declaring a variable as final?