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
Explain java coding standards for methods?
What is the difference between class & structure?
How does thread synchronization occurs inside a monitor?
What are the restrictions imposed on method overriding?
What is callablestatement? How you can call stored procedure to pass in parameter?
Can we call the constructor of a class more than once for an object?
Difference between java and javascript
what is object-oriented programming in java?
What is the purpose of tostring() method in java?
Write java program to reverse string without using api?
What are the restrictions that are applied to the java static methods?
A person says that he compiled a java class successfully without even having a main method in it? Is it possible?
What is number data type?
Can we assign the reference to this variable?
Explain, java is compatible with all servers but not all browsers?