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. Hi Guys, thanks for sharing this... I have some mo
View Tutorial          By: Fins at 2011-12-14 04:40:09

2. You can have a look at the tutorial written by Era
View Tutorial          By: John Berger at 2011-03-26 09:24:22

3. Hi Jim, to get the code for this clock, right clic
View Tutorial          By: Rajan at 2008-04-11 08:25:03

4. It is an excellent article. Please keep up the goo
View Tutorial          By: sanjay at 2011-03-09 03:17:45

5. respected Sir , I am doing B.Tech . I want to know
View Tutorial          By: naveen juneja at 2011-09-18 07:58:04

6. HELP! HELP! HELP!
i got an time out at step

View Tutorial          By: sumit at 2009-04-03 20:19:51

7. provided examples are very useful.
View Tutorial          By: Technical Guy at 2010-04-25 08:12:06

8. Thank you for this tutorial. Thank you all the mor
View Tutorial          By: sd at 2013-09-09 05:38:52

9. i cannot add attachment
its saying
&

View Tutorial          By: Rintu Das at 2012-05-04 18:07:48

10. Good one. Clear basic concept
View Tutorial          By: Joshua at 2010-03-12 01:13:08