Page 44 - CTS - CSA TP - Volume 2
        P. 44
     COMPUTER SOFTWARE APPLICATION - CITS
           Step 2: Declaring the Class
           This line declares a public class named ScannerExample. All Java applications must have a class with a main
           method, and this is the starting point of the program.
           Step 3: Declaring the main Method
           This line declares the main method, which is the entry point of the Java program. The method takes an array of
           String arguments (args), though in this case, it is not used.
           Step 4: Creating a Scanner Object
           This line creates a new Scanner object named scanner that reads input from the standard input stream (System.
           in), which represents the keyboard.
           Step 5: Prompting User Input
           This line prints the prompt “Enter your name: “ to the console, prompting the user to enter their name.
           Step 6: Reading User Input
           This line uses the nextLine method of the Scanner class to read the entire line of text entered by the user. The
           entered text is then stored in the String variable name.
           Step 7: Displaying Output
                                                           29
                               CITS : IT & ITES - Computer Software Application - Exercise 84





