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+2;
the answer is 1) three
| Is This Answer Correct ? | 5 Yes | 1 No |
Post New Answer View All Answers
How does queue work in java?
What is the use of StringTokenizer class?
Explain about serializable interface in java?
What is difference between class and object in java?
How to access arraylist elements in java?
What is the symbol for average?
Does importing a package imports its sub-packages as well in java?
Which is a valid identifier?
What are predefined functions?
How to stop a thread in java? Explain about sleep () method in a thread?
Tell us something about set interface.
What is wrapper class html?
What is java in detail?
Does A Class Inherit The Constructors Of Its Superclass?
What is port number in java?