瀏覽代碼

Alice and Bob Greeting

Soujanya Buragapu 6 年之前
父節點
當前提交
1a4b38063b
共有 4 個檔案被更改,包括 40 行新增9 行删除
  1. 二進制
      Main.class
  2. 7
    0
      Main.ctxt
  3. 26
    2
      Main.java
  4. 7
    7
      package.bluej

二進制
Main.class 查看文件


+ 7
- 0
Main.ctxt 查看文件

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

+ 26
- 2
Main.java 查看文件

@@ -1,9 +1,33 @@
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
-    public static void main(String[] args ){
7
+    public static void main(String[] args )
8
+    {
9
+    }
10
+    public void greetings(){
11
+            
12
+
13
+        Scanner input = new Scanner(System.in);
14
+        System.out.println("please enter you name: ");
15
+
16
+        String name = input.next();
17
+        if (name.equals( "Alice"))
18
+        {
19
+            System.out.println("Hello " + name );
20
+        }
21
+        else if (name.equals("Bob"))
22
+        {
23
+            System.out.println("Hello "+ name);
24
+        }
7 25
 
26
+        else
27
+        {
28
+            System.out.println("Sorry");
29
+
30
+        }
8 31
     }
9
-}
32
+
33
+}

+ 7
- 7
package.bluej 查看文件

@@ -1,16 +1,16 @@
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=714
3
+editor.fx.0.width=800
4
+editor.fx.0.x=324
5
+editor.fx.0.y=23
6 6
 objectbench.height=101
7
-objectbench.width=776
7
+objectbench.width=461
8 8
 package.divider.horizontal=0.6
9 9
 package.divider.vertical=0.8007380073800738
10 10
 package.editor.height=427
11 11
 package.editor.width=674
12
-package.editor.x=181
13
-package.editor.y=109
12
+package.editor.x=246
13
+package.editor.y=48
14 14
 package.frame.height=600
15 15
 package.frame.width=800
16 16
 package.numDependencies=0