Programming Tutorials

Comment on Tutorial - Method Overriding in Java By Henry



Comment Added by : georgy

Comment Added at : 2009-10-22 02:46:10

Comment on Tutorial : Method Overriding in Java By Henry
I HAVE ONE DOUBT.

public class Animal {

public static void testClassMethod1() {
System.out.println("The class method in Animal.");
}
public void testInstanceMethod() {
System.out.println("The instance method in Animal.");
}
}


public class Cat extends Animal {
public static void testClassMethod() {
System.out.println("The class method in Cat.");
}
public void testInstanceMethod() {
System.out.println("The instance method in Cat.");
}
}


public static void main(String[] args) {
// TODO code application logic here
Cat myCat = new Cat();
myCat.testClassMethod1();

}
my QUESTION is that can we call "myCat.testClassMethod1()" as OVERRIDING.if yes then why?


View Tutorial