Java Q&A
by Kenneth Hittleman and Ted Leung


Listing One
public class MyWindow extends java.awt.Window {
    public Vector getOwnedWindows() {
        // body of getOwnedWindows
    }
    // ... rest of MyWindow
}

Listing Two
public class MyWindow extends java.awt.Window {
    public Window[] getOwnedWindows() {
        // body of getOwnedWindows
    }
    // ... rest of MyWindow
}

Listing Three
public class MyJDBCConnection implements java.sql.Connection {
   // body of class ...
}

Listing Four
public class MyJDBCConnection implements java.sql.Connetion {
    // body of class from above ...
    public Map getTypeMap() throws SQLException {
        // new code
    }
}

Listing Five
public integer indexOfNull(Vector v) {
    return v.indexOf(null);
}

Listing Six
class WidgetManager extends Vector {
    public boolean add(Object o) {
        // body of add
    }
    // remainder of WidgetManager
}

Listing Seven
public String fontName() {
    Font testFont = new Font("BogusFontName", Font.ITALIC, 9);
    return (testFont.getName());
}

Listing Eight
public String fontName() {
    Font testFont = new Font("BogusFontName", Font.ITALIC, 9);
    return (testFont.getFamily());
}

Listing Nine
Properties p = new Properties();
OutputStream out = null;
String header = null;
p.put("key", "value");
p.save(out, header);

Listing Ten

PipedOutputStream pipedStream = new PipedOutputStream(newPipedInputStream());
BufferedOutputStream bufferedStream = new BufferedOutputStream(pipedStream,0);

Listing Eleven 
public boolean readyTest {StringReader r) {
   return  r.ready();
}

Listing Twelve
public boolean readyTest(StringReader r) {
    try {
        return r.ready();
    } catch (IOException e) {
        System.out.println("StringReader not ready");
    }
}

Listing Thirteen
public String whatPath() {
    File myFile=new File("/");
    return (myFile.getPath());
}

Listing Fourteen
public void putStuffOnProperties(Properties p) {
    p.put("Number",1);
}

3


