Assignment #61 and Keep Guessing

Code

    ///Name: Tim Gibson
    ///Period: 6
    ///Project Name: Keep Guessing
    ///File Name: NumberGuessing2.java
    ///Date Finished: 10/19/15
        
    import java.util.Scanner;
    import java.util.Random;
    
    public class NumberGuessing2
    {
        public static void main ( String[] args )
        {
            Scanner keyboard = new Scanner(System.in);
            
            Random r = new Random();
            
            int num, guess;
            
            num = 1 + r.nextInt(10);
            
            System.out.print( "I'm thinking of a number from 1 to 10.\nYour Guess: " );
            guess = keyboard.nextInt();
            
            while ( guess != num )
            {
                System.out.print( "Sorry, that wasn't the number. Guess again.\nYour Guess: " );
                guess = keyboard.nextInt();
            }
            
            System.out.println( "\nThat's right, my secret number was " + num + "!" );
        }
    }
        

Picture of the output

Assignment61