import java.lang.*; import java.io.*; /** This class is a very old and silly program invented by Robert D. Parslow, UK to demonstrate how to read and write data and how respond differently to it. Also how to write a loop. @author Dick Botting */ public class Luv { /** Application Starting point Uses "doit()" to get the work done. Demonstration of calling a subprogram in the same class. */ public static void main(String argv[]){ doit(); System.exit(0); } /** A Sample subprogram with a loop, input, output, and a little bit of string handling. This program tries to get you to say that you love it, and won't stop until you do. Used by "main" when called as an application */ public static void doit() { /* Was deprecated DataInputStream in=new DataInputStream(System.in); */ BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Do you love me? "); try{ while(! (in.readLine()).equals("Yes") ){ System.out.println("I hate you! "); System.out.println("Do you love me? "); }//while System.out.println("I love you too"); } catch(Exception e){ System.out.println("Goodbye!"); }//try }//doit }//Luv