protected void finalize() throws Throwable { ... }
public static void main(String[] args) public static void main() public static int main(String[] args) public static int main()
There is no difference between executable programs under cygwin and those "native" to Windows. Suppose you installed java in some standard location (say C:/"Program Files"/jdk1.4.1/bin) then you can directly invoke it. Better still, just link to it: > cd /usr/local/bin > ln -s /cygdrive/c/"Program Files"/jdk1.4.1/bin/javac.exe . > rehash > javac myProg.java -- now you can directly call javac If you need to access CLASSPATH, you can set this in the Control Panel, under Systems. Alternatively, you can give this as an argument to javac. E.g., you have a jar file in your cygwin directory /java/lib/pg73jdbc.jar, you can access it thus: > javac -classpath C:/cygwin/java/lib/pg73jdbc.jar myProg.java Note that the path here begins from C:, and assumes your cygwin is found under C:/cygwin.
class X { int val; X(int a) {val = a;} X() {X(1);} // calls X(a) }
The first is to use method overloading where simpler versions of the method (i.e., those with fewer parameters) invoke the more complete version of the method with the default values appropriately specified in the argument list. The second is to identify special cases directly and then substitute the default values. Here's an example of the first from Scott Stanchfield: Basically, you define one method that has all of the parameters present. This method will perform all of the necessary processing. Then, you overload the method will some parameters missing. These overloaded methods call the one with all parameters by passing in default values. For example: public void foo(String name, int age, double income, Color eyeColor) { this.name = name; this.age = age; this.income = income; this.eyeColor = eyeColor; } public void foo(String name, int age, double income) { foo(name, age, income, Color.blue); } public void foo(String name, int age) { foo(name, age, 10000, Color.blue); } public void foo(String name) { foo(name, 20, 10000, Color.blue); } public void foo(String name, double income) { foo(name, 20, income, Color.blue); } Here's an example of the second approach: public void foo(String name, int age, double income, Color eyeColor) { if (name == null) this.name = "John Doe"; if (age <= 0) this.age = 20; if (income <= 0) this.income = 10000; if (Color == null) this.color = Color.blue; }
Here is a page from http://java.sun.com/docs/books/tutorial/essential/system/properties.html
Remark: Apparently you have a declaration of the form
public class MyList
errorFlag=false; ... if (errorFlag) throw new RuntimeException("My Error!");There is no other code to write...
public void paint(Graphics g) { Dimension appletSize = this.getSize(); int mySize = appletSize.height; int myWidth = appletSize.width; g.drawString("This applet is " + myHeight + " pixels high by " + myWidth + " pixels wide.", 15, appletHeight/2); }
Please send comments to yap(at)cs.nyu.edu.