Assignment #78 and Counting with a For Loop

Code

    /// Name: Ali Kurland
    /// Period: 6
    /// Program Name: Counting with a For Loop
    /// File Name: CountingFor.java
    /// Date Finished: 10/22/2015
    
    // 1. n = n+1 adds one to n each time the code below the "for" runs. Without it, the code runs infinitely because n never exceeds 5. 
    // 2. int n = 1 declares the integer n and sets it equal to 1. Without it, the program does not compile because n has not been declared.
    
    import java.util.Scanner;
    
    public class CountingFor
    {
        public static void main( String[] args )
        {
            Scanner keyboard = new Scanner(System.in);
    
            System.out.println( "Type in a message, and I'll display it ten times." );
            System.out.print( "Message: " );
            String message = keyboard.nextLine();
    
            for ( int n = 2 ; n <= 10 ; n = n+2 )
            {
                System.out.println( n + ". " + message );
            }
    
        }
    }
    

Picture of the output

Assignment 78 Assignment 78 Assignment 78