Ahmad Rusdi 6 years ago
parent
commit
88c655e141
2 changed files with 11 additions and 4 deletions
  1. BIN
      Main.class
  2. 11
    4
      Main.java

BIN
Main.class View File


+ 11
- 4
Main.java View File

1
 /**
1
 /**
2
  * Created by iyasuwatts on 10/17/17.
2
  * Created by iyasuwatts on 10/17/17.
3
  */
3
  */
4
-public class Main {
4
+import java.util.Scanner;
5
 
5
 
6
-    public static void main(String[] args){
7
-        
8
-    }
6
+public class Main { 
7
+  public static void main(String[] args){
8
+    System.out.println("What is your name?: ");
9
+    Scanner scan = new Scanner(System.in);
10
+    String name = scan.nextLine();
11
+    String output = name.equals("Alice") || name.equals("Bob")
12
+      ? "Hello " + name
13
+      : "Stranger danger!";
14
+    System.out.println(output);
15
+  }
9
 }
16
 }