瀏覽代碼

I have a message for Alice and Bob

Akeem Cherry 6 年之前
父節點
當前提交
af84402dc9
共有 4 個文件被更改,包括 22 次插入5 次删除
  1. 二進制
      Main.class
  2. 5
    0
      Main.ctxt
  3. 12
    0
      Main.java
  4. 5
    5
      package.bluej

二進制
Main.class 查看文件


+ 5
- 0
Main.ctxt 查看文件

@@ -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

+ 12
- 0
Main.java 查看文件

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

+ 5
- 5
package.bluej 查看文件

@@ -1,8 +1,8 @@
1 1
 #BlueJ package file
2
-editor.fx.0.height=0
3
-editor.fx.0.width=0
4
-editor.fx.0.x=0
5
-editor.fx.0.y=0
2
+editor.fx.0.height=716
3
+editor.fx.0.width=800
4
+editor.fx.0.x=443
5
+editor.fx.0.y=23
6 6
 objectbench.height=101
7 7
 objectbench.width=776
8 8
 package.divider.horizontal=0.6
@@ -27,6 +27,6 @@ target1.height=50
27 27
 target1.name=Main
28 28
 target1.showInterface=false
29 29
 target1.type=ClassTarget
30
-target1.width=80
30
+target1.width=90
31 31
 target1.x=70
32 32
 target1.y=10