#34 Main.java

Öppen
jtinkler vill sammanfoga 1 incheckningar från s[2]s in i master
3 ändrade filer med 29 tillägg och 3 borttagningar
  1. Binär
      Main.class
  2. 5
    0
      Main.ctxt
  3. 24
    3
      Main.java

Binär
Main.class Visa fil


+ 5
- 0
Main.ctxt Visa fil

@@ -0,0 +1,5 @@
1
+#BlueJ class context
2
+comment0.target=Main
3
+comment1.params=args
4
+comment1.target=void\ main(java.lang.String[])
5
+numComments=2

+ 24
- 3
Main.java Visa fil

@@ -1,9 +1,30 @@
1 1
 /**
2 2
  * Created by iyasuwatts on 10/17/17.
3 3
  */
4
-public class Main {
5 4
 
6
-    public static void main(String[] args ){
5
+   import java.util.Scanner;
6
+   
7
+public class Main {
7 8
 
9
+    public static void main(String[] args ){ 
10
+        /*intialize scanner*/
11
+        Scanner scanner = new Scanner(System.in);
12
+        
13
+        System.out.print("What is your name?");
14
+        
15
+        String name = scanner.nextLine();
16
+        
17
+        if (name.equals("Alice")) {
18
+            System.out.println("Hey Alice ");
19
+        } else if (name.equals("Bob")) {
20
+            System.out.println("Hello Bob!");
21
+        
22
+        } else { System.out.println("Unexpected User");
23
+            
24
+        }
25
+         
26
+        
27
+     }
8 28
     }
9
-}
29
+    
30
+