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. I want java
View Tutorial          By: A.S.Vtihyatharan at 2009-12-01 03:25:36

2. Thanks. But I've also had to use $JAVA_HOME/jre/li
View Tutorial          By: Alex at 2010-03-15 04:17:09

3. i9s this such a hard ?

my head was

View Tutorial          By: shadow_5566 at 2009-05-14 01:32:01

4. How can i download the comm.API .
pls tel

View Tutorial          By: Sajeer kc at 2015-01-16 04:12:28

5. Please give me a example of regionMatches().
View Tutorial          By: A. K. M. Saleh Sultan at 2009-10-05 14:52:25

6. hi ashraf , ramlak and all,
i m new here .

View Tutorial          By: hemendra at 2009-12-28 21:59:34

7. i have json data like coffeename and coffee prize
View Tutorial          By: Paramatma sharan upadhyay at 2015-09-21 12:14:31

8. Great!! Many thanks!
View Tutorial          By: Louis at 2013-06-01 23:16:41

9. can anyone tell how to send sms in asp.net using p
View Tutorial          By: dubail at 2013-04-06 14:17:44

10. I am very comfortable with this example, its very
View Tutorial          By: Inam at 2010-11-07 03:04:46