import java.io.*; public class DoWhileTest { public DoWhileTest() throws IOException{ // Code to handle the data coming from the keyboard InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(isr); readTheInput(br); } /** * This method reads the text the user enters as a String. * Note the use of the do-while loop. */ public void readTheInput(BufferedReader br) throws IOException { String theText = ""; do { System.out.println("Please enter some text"); theText = br.readLine(); System.out.println (theText); } while (!(theText.equals("quit"))); //note the test comes at //the end...so the do-while loop is always executed at least //one time. } /** * Main method. The constructor of this class is called. */ public static void main (String args[]) throws IOException { DoWhileTest dwt = new DoWhileTest(); } }