File tree Expand file tree Collapse file tree 4 files changed +21
-1
lines changed
src/main/java/hexlet/code Expand file tree Collapse file tree 4 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 1+ run-dist :
2+ ./build/install/app/bin/app
Original file line number Diff line number Diff line change @@ -40,4 +40,7 @@ tasks.withType<JavaCompile> {
4040
4141tasks.withType<JavaExec > {
4242 jvmArgs(" --enable-preview" )
43+ }
44+ tasks.getByName(" run" , JavaExec ::class ) {
45+ standardInput = System .`in `
4346}
Original file line number Diff line number Diff line change 11package hexlet .code ;
2+ import java .util .Scanner ;
23
34public class App {
45 public static void main (String [] args ) {
56 System .out .println ("Welcome to the Brain Games!" );
7+ Cli .greetUser ();
68 }
7- }
9+ }
Original file line number Diff line number Diff line change 1+ package hexlet .code ;
2+ import java .util .Scanner ;
3+
4+ public class Cli {
5+ public static void greetUser () {
6+ Scanner scanner = new Scanner (System .in );
7+ System .out .print ("May i have your name? " );
8+ String userName = scanner .next ();
9+ System .out .println ("Hello, " + userName + "!" );
10+
11+ scanner .close ();
12+ }
13+ }
You can’t perform that action at this time.
0 commit comments