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. For me it is executing without error, But not send
View Tutorial          By: Vijay at 2011-02-19 01:51:08

2. the program is writen beautifly and it is easy to
View Tutorial          By: sania cheema at 2009-05-04 12:14:19

3. thank you....
I have a problem.
I my

View Tutorial          By: AbhiRules at 2010-08-05 20:55:27

4. Can u plz send me woking application (Send sms) J
View Tutorial          By: Ritanshu Goel at 2012-09-22 05:53:24

5. Very good explanation along with the example. Can
View Tutorial          By: Divya at 2010-09-21 03:05:10

6. really helpul........
pls mail me some more

View Tutorial          By: shivani at 2010-07-17 01:47:30

7. i need some more basic programes in java
View Tutorial          By: nivin at 2012-10-19 09:14:27

8. It's so crazy to the adventures of J2ME side and w
View Tutorial          By: jaikarthik at 2009-01-18 23:42:42

9. yes it is good example for abstract classes.Thanks
View Tutorial          By: Nilesh Chavan at 2010-07-17 02:24:42

10. Hey thanks for your tutorial. But i'm getting an e
View Tutorial          By: acc at 2013-07-25 14:30:50