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. Okay, I have implemented this and it works, except
View Tutorial          By: Matthew at 2009-06-16 13:08:48

2. Can u please tell me how to compile and execute a
View Tutorial          By: RJ at 2010-04-20 01:30:10

3. Like every other Java recursion example, this exam
View Tutorial          By: Uriah at 2010-05-08 18:59:16

4. Here is my approach for writing equals() method fr
View Tutorial          By: Javin @ eclipse remote debugging at 2011-04-09 06:50:44

5. thanks. that was fair enough. :)
View Tutorial          By: Mustafa at 2010-05-16 10:12:33

6. The example is good but there is an easy to iterat
View Tutorial          By: manish at 2013-03-24 16:21:03

7. good work.
if there is a ValidatorForm the

View Tutorial          By: floriano at 2008-10-09 07:23:16

8. hi, ashray p shetty
can you please tell me

View Tutorial          By: amrish at 2010-12-12 07:30:49

9. i don't understand the input attributes can u plea
View Tutorial          By: dhanalakshmi at 2011-05-05 07:10:25

10. Hi, from where i can download javax.comm API jar f
View Tutorial          By: Chandra at 2008-11-19 11:49:46