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
Add a value x to array from index l to r where 0 <= l <= r <= n-1
Is arraylist a class in java?
What are multiple inheritances?
What is blank final variable?
What is jvm? Why is java called the platform independent programming language?
Are private methods final?
How do you define a variable?
Can we use static class instead of singleton?
What is difference between equals and hashcode method?
How many classes can any class inherit java?
Where is the singleton class used?
What are the ways in which a thread can enter the waiting state?
What if constructor is protected in java?
How do you sort words in java?
What do you mean by byte code?