Thursday, September 21, 2006

WhileExample



      import java.util.*;
public class WhileExample
{
	public static void main(String[] args)
	{
		String response = "y";
		
		Scanner scan = new Scanner(System.in);
		
		while (response.equalsIgnoreCase("y"))
		{
			//code goes here
		
			System.out.print("Again? (y/n): ");
			response = scan.next();
		
		}
	}
}

0 Comments:

Post a Comment

<< Home