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
- Data Science
- Android
- AJAX
- ASP.net
- C
- C++
- C#
- Cocoa
- Cloud Computing
- HTML5
- Java
- Javascript
- JSF
- JSP
- J2ME
- Java Beans
- EJB
- JDBC
- Linux
- Mac OS X
- iPhone
- MySQL
- Office 365
- Perl
- PHP
- Python
- Ruby
- VB.net
- Hibernate
- Struts
- SAP
- Trends
- Tech Reviews
- WebServices
- XML
- Certification
- Interview
categories
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
Count number of vowels, consonants and digits in a String in Java
Student marks calculation program 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
Archived Comments
1. Sir i am doing b.tech and i want to know about Gar
View Tutorial By: waseem at 2010-10-10 01:28:42
2. The following line in the code
((NewThread)
View Tutorial By: Carlos at 2009-11-18 14:34:51
3. Thank you!!!
just to make things c
View Tutorial By: Oscar Torres at 2015-02-19 14:25:05
4. this site is good, can anyone plz suggest me how t
View Tutorial By: Prithvi at 2008-08-27 01:09:56
5. Plz tell me the classes to import for this code an
View Tutorial By: Nitin at 2009-11-10 02:54:50
6. Thanks ,It is very useful...
View Tutorial By: SABARISH at 2014-08-08 05:46:43
7. help me for this nested for loops
2 3 4 5
View Tutorial By: nadzirah at 2012-10-12 15:33:20
8. # include <iostream.h>
int main ()
View Tutorial By: nazarine at 2011-07-06 06:17:10
9. The above code given for sending SMS through your
View Tutorial By: ROHAN at 2008-10-17 00:55:46
10. MySQL Connector/J supports only TCP/IP connections
View Tutorial By: Java Training Institute In Chennai at 2012-09-13 12:37:44