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



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. I don't get it... there seem to be only two differ
View Tutorial          By: bibiki at 2012-04-05 02:01:32

2. i want to make java editore in my major project.i
View Tutorial          By: pawan patel at 2012-04-14 11:15:19

3. This is awesum !!!
easy to understand ....

View Tutorial          By: Sud at 2011-01-19 08:37:55

4. Hello , How could i Run java.comm on eclipse

View Tutorial          By: Fiars at 2011-04-11 04:53:45

5. good......
View Tutorial          By: Sudip Khatiwara at 2010-04-05 22:31:06

6. thank you..!!
really very helpful...

View Tutorial          By: sneha at 2012-01-30 18:01:16

7. org.replaceAll("is","was"); en
View Tutorial          By: nirosha at 2013-01-28 16:19:11

8. This example is very useful....Thanks for your sha
View Tutorial          By: raji at 2015-05-22 07:19:07

9. Plz show me how to use main method reccurssively p
View Tutorial          By: Jyoti Bankar at 2011-07-14 10:31:53

10. It's very very useful for me. thank you.
View Tutorial          By: thirumalai at 2009-01-28 03:25:25