Comment on Tutorial - Method Overriding in Java By Henry



Comment Added by : DevJ

Comment Added at : 2011-03-18 05:41:52

Comment on Tutorial : Method Overriding in Java By Henry
@readers
this is an example of Hiding and Not Overriding. As overriding doesnt apply to static methods.


---------------------------
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?

By: georgy at 2009-10-22 02:46:10


View Tutorial



Subscribe to Tutorials

Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. can any body help me ??????????
i `he get a

View Tutorial          By: gkggt at 2013-02-11 12:09:04

2. Hi there, I was able to build this properly but he
View Tutorial          By: Damien at 2012-01-30 17:37:20

3. i think this ist perfectly fine :) if you don't kn
View Tutorial          By: julian at 2011-03-07 05:54:08

4. return type doesn't influence the overloading. Onl
View Tutorial          By: Shekhar at 2010-05-17 01:22:04

5. I used the script above, and it seems to work exce
View Tutorial          By: Michael at 2012-05-15 20:50:49

6. I am suffering with the same error as of ganesh...
View Tutorial          By: Sri Bhavani at 2008-09-30 00:18:38

7. In 6th point .....there is a spelling mistake...mi
View Tutorial          By: Gnani at 2009-09-22 12:25:59

8. Caught java.lang.ClassNotFoundException: com.sun.c
View Tutorial          By: A.Balaji at 2010-09-13 00:15:48

9. nice one its very useful
View Tutorial          By: jhejhe at 2010-02-21 05:03:50

10. thanks
View Tutorial          By: snooker at 2013-02-04 19:45:40