Originally by Jeff:
--------------------------------------------------
public class Test1
{
public static void testMethod()
{
System.out.println("Testing");
}
}
public class Test2 extends Test1
{
public static void main(String[] args)
{
Test2 test2 = new Test2();
test2.testMethod();
}
}
------------------------------------------------
I think the concept of inheriting static method is well
demonstrated by Jeff above. However, since the static method
testMethod() is already inherited we didn't need to create object in order to access it (testMethod() -- it is already part of the sub-class), we could simply call testMethod() and it would work. The bottom line is that the static method testMethod() is inherited by the sub-class and it is available for use.