Comment on Tutorial - Inheritance Example in Java By Watson
Comment Added by : Adil khan
Comment Added at : 2013-02-12 06:37:17
Comment on Tutorial : Inheritance Example in Java By Watson
I lit'l modified the above program for main class, Its executing for me:
public class InheritanceBicycle {
public static void main(String args[]) {
//create the objects of Bicycle parent class
Bicycle B = new Bicycle(10, 20, 30);
//create the objects of Bicycle child class mountainBike
MountainBike m = new MountainBike(1, 2, 300, 4);
// for Bicycle
System.out.println("value of speed of bicycle " + B.speed);
B.speedUp(7);
System.out.println("value of speed after increase " + B.speed);
System.out.println("value of speed of mountainbike " + m.speed);
m.speedUp(7);
System.out.println("value of speed after increase " + m.speed);
}
}
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
Related Tutorials
Java program to get location meta data from an image
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
Archived Comments
1. good.
View Tutorial By: Karthik at 2007-10-20 07:03:20
2. I want to using swith with string...
How to
View Tutorial By: anuj at 2015-03-04 18:22:29
3. Hello all,Actually i want xml parser in blackberry
View Tutorial By: arun at 2011-06-01 06:17:16
4. I did all steps, but it only shows the first pictu
View Tutorial By: behzad at 2012-07-15 16:32:41
5. thank you so much i learn from your tutorial i wis
View Tutorial By: Anonymous at 2009-01-03 20:08:41
6. its gud 2 learn java sim prog
View Tutorial By: Rakesh at 2009-10-04 03:47:01
7. pls send me the brief description about jdbc conne
View Tutorial By: vikas at 2011-08-09 07:07:53
8. thank you for this quick and easy demonstration. B
View Tutorial By: rajesh at 2012-09-20 17:48:17
9. can u please explain java scripts for menus.
View Tutorial By: web designers in kerala at 2011-04-16 02:08:22
10. i need a J2me PIM for accessing phone contact... <
View Tutorial By: shafique at 2011-06-28 04:11:55