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



Ask a Question

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. Good for Beginners
View Tutorial          By: Srinivasula Reddy at 2009-11-05 02:04:25

2. nice example..
View Tutorial          By: righana at 2011-07-19 08:46:50

3. why 27's example is prone to a deadlock ? when pro
View Tutorial          By: kaka at 2011-08-14 00:59:41

4. Many thanks
View Tutorial          By: tushar at 2010-03-10 01:27:04

5. this code runs permanently!!! created by diko(Turk
View Tutorial          By: ali at 2013-08-12 07:56:01

6. Hi every one. I am working on my project in j2me a
View Tutorial          By: wazir at 2010-11-26 08:27:43

7. A good tutorial! Hope this would help the JSP deve
View Tutorial          By: geetha at 2008-09-12 04:17:14

8. i am very much pleased in this type of tutorial
View Tutorial          By: arup adhikari at 2009-07-10 08:00:24

9. Marvelous Explanation. The whole concept is clear
View Tutorial          By: Rohit at 2009-12-01 19:43:14

10. i am looking for c programs in written
View Tutorial          By: ziyauddin at 2011-02-13 06:21:09