forked from Nnamdikeshi/Java2545examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApollo11Quiz.java
More file actions
28 lines (19 loc) · 763 Bytes
/
Copy pathApollo11Quiz.java
File metadata and controls
28 lines (19 loc) · 763 Bytes
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
package week1_variables_if_else;
import java.util.Scanner;
public class Apollo11Quiz {
static Scanner stringScanner = new Scanner(System.in);
static Scanner numberScanner = new Scanner(System.in);
public static void main(String[] args) {
System.out.println("Quiz time!");
System.out.println("What year did the Apollo 11 spaceship land on the moon?");
//Hint... it was 1969
int answer = numberScanner.nextInt();
// The != operator tests if two values are NOT equal
// This condition tests if answer is not equal to 1969.
if ( answer != 1969 ) {
System.out.println("Wrong answer - it was 1969");
}
stringScanner.close();
numberScanner.close();
}
}