// sample program that uses CTRL-M (ascii 13, Line Feed, \r) to // display a funny output after it rings the bell with CTRL-G (ascii 7, Bell) // Output sent to magic.txt import java.io.*; public class Magic { public static void main(String[] args) throws Throwable { char bell = 7; char cr = 13; String s = "Any sufficiently advanced technology is indistinguishable from magic."; PrintStream output = new PrintStream("magic.txt"); output.println("From Arthur C. Clarke:" + bell); for (int i = 1; i <= s.length(); i++) { String sub = s.substring(0, i); for (int j = 0; j < 50000; j++) { output.print(cr + sub); } } output.println(); output.println("Ha ha!"); } }