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 / venkata krishna

Hi,

Answer is 1 means three..

line 12 is executing sucuessfully ,after that i is 3 now
line 13 is switch also executed successfully and print the
three

Is This Answer Correct ?    8 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between module and function?

542


What is the difference between post and put?

536


What happens to a static var that is defined within a method of a class?

549


what state does a thread enter when it terminates its processing? : Java thread

599


How does multithreading take place on a computer with a single cpu?

544






Can constructor be protected in java?

511


Why is java called java?

541


Are constructors methods?

567


How hashmap works in java?

570


What about method local inner classes or local inner classes in java?

557


What value is a variable of the string type automatically initialized?

613


Does anyone still use java?

582


Can a class extends itself in java?

529


How many ways can we create singleton class?

506


What is oops in java?

567