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
Is namespace same as package in java?
What is ternary operator? Give an example.
What is the purpose of default constructor?
What is the purpose of the system class in java?
What are the different types of garbage collectors in java?
How to display all the prime numbers between 1 and 100
How can you make sure that your singleton class will always return single instance in multi-threaded environment?
What is difference between fail-fast and fail-safe?
What is the largest long allowed by java?
When throw keyword is used?
What is the meaning of variables in research?
Write down program for following scenario. Use java coding standard. You have array list with some words in it..we will call it as dictionary….and you have a arbitrary string containing some chars in it. You have to go through each word of dictionary and find out if that word can be constructed with the help of chars from arbitrary string given. If you find the word print it else print none.
How does map works in java?
Explain the meaning of java applet.
What is not thread safe?