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. Thank you for good explanation. I am thinking of u
View Tutorial          By: Darshan at 2012-06-22 15:44:57

2. It tried this app... It's working fine... really a
View Tutorial          By: Prakash at 2012-01-04 06:33:12

3. Thanks a ton! :)
View Tutorial          By: Prateek at 2015-03-12 11:40:08

4. I do, the necessaries changes to receive messages
View Tutorial          By: wodie at 2011-05-05 20:39:06

5. can anybody tell me the full code for sending sms
View Tutorial          By: shikha at 2008-10-13 11:43:40

6. hiiiiiii

it's good turotiral for s

View Tutorial          By: Raju Singh at 2009-10-01 09:47:04

7. The code is working for me as i have included &quo
View Tutorial          By: MOHAN at 2011-06-29 04:08:04

8. "For example, float can be useful when repres
View Tutorial          By: David at 2009-10-08 13:47:08

9. Once i run it gives the following error.Why "
View Tutorial          By: IDK at 2008-12-18 19:56:12

10. i have run the code successfully but it does not s
View Tutorial          By: amrish at 2010-12-11 07:00:28