Application Templates

To read and write one command line argument. You choose an identifier for "ClassName", such as "ReadOneArgument". There are no other identifiers.

public class ClassName {
  public static void main (String args[]) {
    System.out.println (args[0]);
  }
}

To read and write one line of standard input. You choose identifiers for "ClassName", "object1" and "object2". Try using "ReadWrite", "from_keyboard" and "line" respectively.

import java.io.*;
public class ClassName {
  public static void main (String args[]) throws IOException {
    DataInputStream object1 = new DataInputStream(System.in);
    String object2 = object1.readLine();
    System.out.println (object2);
  }
}


Applet Templates

import java.applet.*;
import java.awt.*;
public class aplhw extends Applet {
  public void paint (Graphics page) {
  }
}


Most general form

import java.applet.*;
import java.awt.*;
public class aplhw extends Applet {
  public void init () {;}
  public void start () {;}
}