Assignment #70 and Flip Again

Code

    ///Name: Tim Gibson
    ///Period: 6
    ///Project Name: Flip again
    ///File Name: FlipAgain.java
    ///Date Finished: 10/21/15
        
    import java.util.Random;
    import java.util.Scanner;
    
    public class FlipAgain
    {
    	public static void main( String[] args )
    	{
    		Scanner keyboard = new Scanner(System.in);
    		Random rng = new Random();
    
    		String again;
    
    		do
    		{
    			int flip = rng.nextInt(2);
    			String coin;
    
    			if ( flip == 1 )
    				coin = "HEADS";
    			else
    				coin = "TAILS";
    
    			System.out.println( "You flip a coin and it is... " + coin );
    
    			System.out.print( "Would you like to flip again (y/n)? " );
    			again = keyboard.next();
    		} while ( again.equals("y") );
    	}
    }
    //3. The program still works when the line is changed back to how it was originally. This is because since it's a do while strinng, it doesnt check if the condition has been met until after it has run through the code contained in it once, and after it's been run through once, again has been initialized.
        

Picture of the output

Assignment70