The purpose of having an abstract method is to be able to invoke the method on subclasses polymorphically.
For example:
<pre>
// file: Test.java
class Super {
abstract void foo();
}
class Sub1 extends Super {
void foo() {
System.out.println("Sub1.foo()");
}
}
class Sub2 extends Super {
void foo() {
System.out.println("Sub2.foo()");
}
}
public class Test() {
public static void main(String[] args) {
Test test = new Test();
Sub1 s1 = new Sub1();
Sub2 s2 = new Sub2();
test.callFoo(s1);
test.callFoo(s2);
}
void callFoo(Super obj) {
obj.foo(); // polymorphic call to foo()
}
}
</pre>
In the callFoo() method, the JVM determines the actual type of obj and then calls the appropriate foo method. This happens at runtime and it is called "dynamic binding".
"Static binding" on the otherhand, occurs at compile time. This is how calls to static methods are resolved (thus the name "static"). Static methods do not participate in polymorphic calls.
Michael Daconta's discusses this in his book "Java Pitfalls"
HTH
------------------
Junilu Lacar
Sun Certified Programmer for the Java� 2 Platform
[This message has been edited by JUNILU LACAR (edited November 06, 2001).]