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



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. Re: Inner Classes
Aside from allowing acces

View Tutorial          By: lee smith at 2010-01-17 10:59:23

2. really a gud work for xml parsing readers
View Tutorial          By: shreya at 2010-07-02 02:35:04

3. Program is good and easy to understand
View Tutorial          By: sravs at 2011-05-16 00:45:05

4. A wonderful tutorial to learn XML Processing with
View Tutorial          By: Madhan at 2011-09-13 19:37:08

5. Thanx.. it helps me a lot, now.. i have 1 more que
View Tutorial          By: GuzZpaWn at 2012-01-15 17:19:29

6. Awesome article. It's very useful. Despite it didn
View Tutorial          By: Matheus at 2015-02-24 12:06:05

7. Seems to be the best tutorial on this topic. At le
View Tutorial          By: Bob Nickson at 2008-08-26 02:50:29

8. Hi I would like to get help with a client-server d
View Tutorial          By: lolaFireBird at 2012-06-29 08:04:31

9. hai.....people ..............


View Tutorial          By: spartan at 2009-08-08 08:42:35

10. I want to ask, can a formula be inserted in this s
View Tutorial          By: chika at 2011-02-02 17:18:59