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. Thanks! Very helpful in creating a program i am tr
View Tutorial          By: BHaos at 2014-12-05 16:32:53

2. Actually, looking at the code, it looks as somethi
View Tutorial          By: Johnson at 2009-07-28 08:14:38

3. it was very useful to me
View Tutorial          By: balaji at 2012-01-09 22:50:25

4. Im using maxis broadband now.
I want to cre

View Tutorial          By: rayminn at 2012-06-03 21:08:13

5. @Palla Subramanyam : Your logic is correct, but SO
View Tutorial          By: Roopesh H at 2012-07-27 04:47:48

6. i am new to SMS, i think i need a device too. Whic
View Tutorial          By: Usman at 2015-10-05 12:06:34

7. Sir please can you tell me that how can i find occ
View Tutorial          By: Saad at 2013-01-20 11:14:39

8. This tutorial is very much useful for me to develo
View Tutorial          By: R. Lawrance at 2009-07-26 22:03:15

9. to get out of time out at step 2 error i used to
View Tutorial          By: Niluk at 2014-06-04 05:58:03

10. i want source code of Send SMS on Mobile by Net.
View Tutorial          By: Ankit Patel at 2011-07-05 08:43:14