1)Private methods are never inherited hence they can never be overriden. Hence private method calls are bound at compile-time & not at run-time.
eg:
class Base
{
private void foo()
{
}
public static void main(
String[] args)
{
Base b = new Derived();
b.foo();
}
class Derived extends Base
{
private void foo()
{}
}
In the above example, foo() of Base will be called even though b references Derived object. This is what is mean by "private methods are statically-bound".
2)Same explanation goes for static methods (in the above example replace private with static). Static methods and variables are bound at compile-time. A good example of this would be:
AnObject o = null;
o.anyStaticMethod();
The above code will NOT throw a null-pointer exception since static methods are bound at compile-time.
3)Interface can be declared public or default. However irrespective of whether an interface is public or not, the fields declared in an interface are always public static & final by default, whether you explicitly declare them or not. Similarly methods of any interface are always public and abstract by default.
Hope this clears the confusion!
Junaid Bhatra
Sun Certified Programmer for the
Java 2 Platform