Create a more advanced Hello World program in which you could insert your own name. So, the program can ask for an input. In this case, the program will ask for your name and give after that the output: “Hello World” and the name of the programmer.
For this extra option, you have to add a scan option. In the previous part (Hello World) the PrintStream we used “System.out”, now we will use “System.in”. the whole line we have to add is “Scanner in = new Scanner(System.in);”. But as we did before we split “Scanner in;” and “in = new Scanner(System.in);”, and of course import the scanner function “import java.util.Scanner;”. Something you also have to do is close the scanner with: “in.close();”.
Click here for more information about print (println, printf, etc..)
Click here for more information about scanner in (in.nextLine, in.nextInt, etc..)