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



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 for this. I was checking and double checkin
View Tutorial          By: Alex at 2011-07-10 09:03:56

2. Ku is quite correct. When you create any object, i
View Tutorial          By: Avnish at 2010-10-28 04:00:20

3. Excelente, y a pesar de que mi inglés
View Tutorial          By: Monica at 2009-03-24 13:53:51

4. javax.comm.NoSuchPortException
at javax.co

View Tutorial          By: Prakash at 2008-04-14 06:22:38

5. This matter is really too good.
View Tutorial          By: Ashwin perti at 2009-07-08 04:43:55

6. excellent, very clear, thx!!!
View Tutorial          By: ma at 2010-04-07 07:42:47

7. I managed to get the program working. However I ha
View Tutorial          By: Anthrax at 2012-02-15 10:11:19

8. Best Example sir
View Tutorial          By: Hiren Dangar at 2015-04-23 06:55:26

9. i want to get the SCJP ceretificate plz anybody ca
View Tutorial          By: arpita kotadia at 2012-09-01 06:50:03

10. I executed your code but i get the error "OK
View Tutorial          By: Denzil at 2013-01-18 09:33:37