© 2014 Firstsoft Technologies (P) Limited. login
Hi 'Guest'
Home SiteMap Contact Us Disclaimer
enggedu

Home Placements Interview Questions Java Interview Questions And Answers Java Interview Questions On Flow Control and Exception Handling ▼

Java Interview Questions On Flow Control and Exception Handling

26. What is the result when you compile and run the following code?
int i = 100;
switch (i) {
case 100:
System.out.println(i);
case 200:
System.out.println(i);
case 300:
System.out.println(i);
}
[a] Nothing is printed
[b] Compile time error
[c] The values 100,100,100 printed
[d] Only 100 is printed

Answer
[c] The values 100,100,100 printed

27. What is the result when you compile and run the following code?
int i = 100;
switch (i) {
case 100:
System.out.println(i);
break;
case 200:
System.out.println(i);
break;
case 300:
System.out.println(i);
break;
}
[a] Nothing is printed
[b] Compile time error
[c] The values 100,200,300 printed
[d] Only 100 is printed

Answer
[d] Only 100 is printed

28. What is the result when you compile and run the following code?
boolean b = true;
if (b) {
System.out.println("True");
} else {
System.out.println("False");
}
[a] Nothing is printed
[b] True is printed
[c] False is printed
[d] Compile time error

Answer

[b] True is printed
Previous Next
1 2 3 4 5 6 7 8 9
SLogix Student Projects
bottom