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 / nirmal

Ans 4: Compilation fails because of an error on
line 12.

Reason: The operator + is undefined for the argument type
(s) java.lang.Integer, java.lang.Integer Cannot switch on a
value of type Integer. Only int values or enum constants
are permitted.

Is This Answer Correct ?    0 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

which is advanced deep technology in java launched by the sun microsystem??? The answer is very logical If u need correct answer mail me at priya_gupta@gmail.com

3457


What is anagram in java?

736


List some important characteristics on jre

851


State the merge-sort principle and its time complexity.

774


Explain about sets?

785


What is the latest version of java?

826


What is the difference between JVM and JRE?

845


What is method in java with example?

723


What is final int?

753


Explain about narrowing conversion in java?

799


What access modifiers can be used for variables?

848


What are the benefits of operations in java?

708


What is subsequence of a string?

870


Difference between object instantiation and construction ?

841


How many types of assembly languages are there?

742