/** * HelloWorld.java * * @author Jeff Ondich * * This program illustrates the simplest form of output * using the JavaBook classes from C. Thomas Wu's * "An Introduction to Object Oriented Programming With Java," * McGraw-Hill, 2001. * * 1. Try it. Assuming you are viewing this code from within * BlueJ, you should see a "Compile" button at the top of the * window containing this text. Click on it. After a few moments, * you will see "Class compiled - no syntax errors." * * So far so good. Now go back to the project window, right-click * on the orange "HelloWorld" class rectangle, and select * "void main(args)." Click on OK. Two windows should appear--one * big one (that's the MainWindow object "mw") and one little one * (the OutputBox object "out") containing the traditional computer * science greeting. * * 2. Experiment with what happens if you "comment out" various * lines of code. To comment out a line, put two slashes (//) at * the beginning of the line. What happens if you comment out * the MainWindow mw = new MainWindow() line? How about one or both * of the setVisible lines? */ import javabook.*; class HelloWorld { public static void main( String[] args ) { MainWindow mw = new MainWindow(); mw.setVisible( true ); mw.toFront(); OutputBox out = new OutputBox( mw ); out.setVisible( true ); out.toFront(); out.printLine( "Hello, world." ); } }