Skip to content

Commit cb0c923

Browse files
committed
added Makefile, created class Cli, updated class App
1 parent ffbb8f2 commit cb0c923

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

app/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
run-dist:
2+
./build/install/app/bin/app

app/src/main/java/hexlet/code/App.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
public class App {
44
public static void main(String[] args) {
5-
System.out.println("Welcome to the Brain Games!");
5+
Cli.sayHello();
66
}
77
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package hexlet.code;
2+
3+
import java.util.Scanner;
4+
5+
public class Cli {
6+
public static void sayHello() {
7+
Scanner scanner = new Scanner(System.in);
8+
9+
System.out.println("Welcome to the Brain Games!");
10+
System.out.print("May I have your name? ");
11+
String name = scanner.nextLine();
12+
13+
System.out.println("Hello, " + name + "!");
14+
15+
scanner.close();
16+
}
17+
}

0 commit comments

Comments
 (0)