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. Thank you very much. Very useful. You are the best
View Tutorial          By: lin at 2011-01-19 00:09:35

2. Also note that for reverse ordering, If you have a
View Tutorial          By: Dwight at 2011-07-13 22:13:45

3. hi friends,
can i write the same jdbc code

View Tutorial          By: mahesh at 2012-01-05 05:09:38

4. I have some questions : 1) Which type of GC used
View Tutorial          By: SP at 2013-06-04 15:48:59

5. I went befly through this, it is woderful, usefull
View Tutorial          By: Mallikarjuna.N at 2009-11-28 11:41:58

6. Thanks for giving this basic example of Abstract c
View Tutorial          By: Yogendra Kirar at 2010-08-07 07:48:34

7. thanks! great tutorial!
View Tutorial          By: Gracia at 2013-01-10 07:58:06

8. Whne i run this code ,it does not return any ports
View Tutorial          By: amit at 2009-06-10 02:11:13

9. thanks...........its really very helpful for me...
View Tutorial          By: ashwini agarmore at 2013-01-17 06:31:21

10. I wont to know about every thing of java
View Tutorial          By: susantha at 2009-10-11 09:35:40