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+3;
| Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
what do you mean by stream pipelining in java 8? Explain
What is the purpose of format function?
What is string builder in java?
Is java a digit method?
How many bits is a string in java?
Is age a discrete variable?
How does linkedlist work in java?
Do loops java?
What's a method in programming?
What is the difference between static and non-static variables in java programming?
How are destructors defined in java?
os is developed in c no java is more secured then c na why dont the os developed is developed using java
Does constructor be static?
Which method cannot be overridden in java?
What is a private class in java?