Adding the comments for the early CS's

This commit is contained in:
2024-06-28 17:15:46 -04:00
parent b979027552
commit 6336ce0e2d
7 changed files with 158 additions and 5 deletions

View File

@@ -1,12 +1,23 @@
import java.util.Scanner;
/*
CS2 Challenge Solution
Original Challenge Description: Build a program that requests a user's name,
and then prints a greeting.
*/
public class Main {
public static void main(String[] args) {
//Setup a Scanner to work with System.in
Scanner scan = new Scanner(System.in);
//Start by printing some text that will prompt the user to enter a name
//then print another line that Says "Hello" and then whatever the user entered.
System.out.print("Please enter your name: ");
System.out.println("Hello " + scan.nextLine());
//Close the scanner, while not really necessary, it's a good habit to get into
//for other resources.
scan.close();
}
}