Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Need help with console program?
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


francis mag
Need help with console program?
1 Answer(s)      2 years and 2 months ago
Posted in : Java Beginners


Write a console program that repeatedly prompts the user to enter data until they type done (any case, Upper, Lower, or Mixed).

thanks in advance.


Advertisement
View Answers

July 12, 2012 at 10:44 AM


Here is an example that repeatedly prompts the user to enter data until they type 'done' in any case.

import java.io.*;

class Input 
{
    public static void main(String[] args) throws Exception
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        System.out.print("Enter: ");
        String str=br.readLine();
        while(!str.equalsIgnoreCase("done")){
            System.out.print("Enter: ");
            str=br.readLine();
        }
    }
}


Related Tutorials/Questions & Answers:
Advertisements
 

 

 

DMCA.com