Assignment #55 and Number Guessing Game

Code

    ///Name: Tim Gibson
    ///Period: 6
    ///Project Name: Number Guessing Game
    ///File Name: NumberGuessing.java
    ///Date Finished: 10/15/15
        
    import java.util.Scanner;
    import java.util.Random;
    
    public class NumberGuessing
    {
        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();
            
            if ( guess == num )
                System.out.println( "\nThat's right, my secret number was " + num + "!" );
            else if ( guess < 1 || guess > 10 )
                System.out.println( "\nCheater, that's not a number between 1 and 10! \nI was thinking of the number " + num + " by the way." );
            else 
                System.out.println( "\nSorry, but my number was " + num + "." );
        }
    }
        

Picture of the output

Assignment55