CSCI 111: Output Questions

There seems to be some confusion about "output" lines.

There are three aspects we are dealing with at this time.

  1. html pages: have extension .html and are the text for what shows up on a URL (Uniform Resource Locator) with that address.

  2. browsers: we view these html pages on a browser. Example browsers: Netscape, Internet Explorer, appletviewer

  3. Applets: Java programs that run on a browser. Since you want them to run on a browser, you put the applet tag in the .html page with the name of the applet.
We know all this - why is she saying this. Well, how do you get output to print on each medium?

  1. html pages and browsers are intimately tied together. If you want information to show up on the browser, you just type what you want in the .html page. (This really should not be called "output" since output usually means you ran a program to produce it.) Different tags will make the text appear different on the web page on the browser. For applets, you can place the applet at different places on the page
      <applet code="Lab3.class" width=150 height=150></applet>

  2. Output from java programs can go to two places:
    • To the Applet or Frame: on these Components for windowing provided by Java, one needs to use various other Components (text fields, etc) or draw to a Graphics area of the Applet using the Applet's paint method. For example:
        g.drawLine(0,0,100,100); g.drawString("Hello World",50,50);
    • To the System running the program. In java this can be either a Browser for Applets, or the command line for Applications. For example:
        System.out.println("Hello World");
      will show up on the screen where you called the java program if it is an application...or in the Java Console if it is in an Applet. The Java Console is under the Communicator menu choice in Netscape - perhaps it is under the tools submenu. For newer versions of Java (on windows), the applet java console shows up on the bottom menu bar as a cup with red swirling smoke).
Make sure the applet area is big enough to see all of your output.
What does that mean?

Question: Do web pages (html) use // for comments? Think about what a comment is in order to answer this.