-
Notifications
You must be signed in to change notification settings - Fork 11
/
Question37.java
42 lines (41 loc) · 856 Bytes
/
Question37.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package io.github.mariazevedo88.javaoca.chp.three.caelum.operators;
/**
* @author Mariana Azevedo
* @since 29/06/2019
*
* Question 1.3.37 (page 155) - Choose the appropriate option when attempting to compile
* and run the following file:
*
* class A {
* public static void main(String[] args) {
* switch(10) {
* case 10:
* System.out.println("a");
* break;
* System.out.println("b");
* default:
* System.out.println("c");
* case 11:
* System.out.println("d");
* }
* }
* }
*
* a) Compile error. (x)
* b) Prints a and b and c and d.
* c) Prints a.
*/
class Question37 {
public static void main(String[] args) {
switch(10) {
case 10:
System.out.println("a");
break;
//System.out.println("b");
default:
System.out.println("c");
case 11:
System.out.println("d");
}
}
}