File tree Expand file tree Collapse file tree 3 files changed +22
-1
lines changed
src/main/java/hexlet/code Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -21,4 +21,8 @@ dependencies {
2121
2222tasks.test {
2323 useJUnitPlatform()
24+ }
25+
26+ tasks.getByName(" run" , JavaExec ::class ) {
27+ standardInput = System .`in `
2428}
Original file line number Diff line number Diff line change 22
33public class App {
44 public static void main (String [] args ) {
5- System . out . println ( "Welcome to the Brain Games!" );
5+ Cli . welcomeUser ( );
66 }
77}
Original file line number Diff line number Diff line change 1+ package hexlet .code ;
2+
3+ import java .util .Scanner ;
4+
5+ public class Cli {
6+ public static void welcomeUser () {
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 userName = scanner .next ();
12+ System .out .println ("Hello, " + userName + "!" );
13+
14+ scanner .close ();
15+ }
16+ }
17+
You can’t perform that action at this time.
0 commit comments