Pārlūkot izejas kodu

Greetings for Alice and Bob

Christian Sheridan 6 gadus atpakaļ
vecāks
revīzija
1a00924ee7
3 mainītis faili ar 14 papildinājumiem un 3 dzēšanām
  1. Binārs
      Main.class
  2. 5
    0
      Main.ctxt
  3. 9
    3
      Main.java

Binārs
Main.class Parādīt failu


+ 5
- 0
Main.ctxt Parādīt failu

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

+ 9
- 3
Main.java Parādīt failu

1
 /**
1
 /**
2
  * Created by iyasuwatts on 10/17/17.
2
  * Created by iyasuwatts on 10/17/17.
3
  */
3
  */
4
+import java.util.Scanner;
4
 public class Main {
5
 public class Main {
5
-
6
+    
6
     public static void main(String[] args ){
7
     public static void main(String[] args ){
7
-
8
-    }
8
+    Scanner in = new Scanner(System.in);
9
+    System.out.print("please enter your first name");
10
+    String firstName = in.nextLine();
11
+    if (firstName.equals ("Alice") || firstName.equals("Bob")){
12
+    System.out.println("Greetings! " + firstName);
9
 }
13
 }
14
+    }
15
+}