Comment on Tutorial - Method Overriding in Java By Henry



Comment Added by : georgy

Comment Added at : 2009-10-22 02:46:10

Comment on Tutorial : Method Overriding in Java By Henry
I HAVE ONE DOUBT.

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?


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. Hi... very nice tute... Thanks..
I am worki

View Tutorial          By: anuj at 2013-03-15 06:12:46

2. Thanks. A couple of typos, though:
- &quo

View Tutorial          By: Steve Parker at 2013-09-25 09:47:08

3. if(a instanceof C)
System.out.println("

View Tutorial          By: John at 2012-07-13 17:34:42

4. Really very nice and step by step explanation hel
View Tutorial          By: sabarish at 2011-11-08 06:47:49

5. I am receiving an error as
Error java.lan

View Tutorial          By: pablo at 2014-08-03 16:10:55

6. i have an exception unknown host.
please te

View Tutorial          By: saddam hussain at 2011-03-22 10:46:48

7. plz send me java prograams
View Tutorial          By: simmy at 2009-10-26 01:57:55

8. Good one
View Tutorial          By: Ravi at 2007-11-19 03:30:40

9. You explained the this Keyword very well.
&

View Tutorial          By: Karan at 2012-12-04 11:27:35

10. Hi Jon,

It really depends on the ap

View Tutorial          By: Hong at 2009-05-04 20:40:28