Comment on Tutorial - Inheritance Example in Java By Watson



Comment Added by : leela

Comment Added at : 2011-09-08 12:16:24

Comment on Tutorial : Inheritance Example in Java By Watson
I executed this program with the help of below code

public class inheritanceBicycle {

public static void main(String args[]) {

//create the objects of Bicycle & mountainBike
Bicycle B = new Bicycle(10,20,30);
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. This is really helpful, i'm planning to also add a
View Tutorial          By: JhunZhen at 2011-07-09 21:42:32

2. wow........thanks a lot :)
View Tutorial          By: shiva at 2015-08-11 07:47:08

3. yes it is good example for abstract classes.Thanks
View Tutorial          By: Nilesh Chavan at 2010-07-17 02:24:42

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

5. super......... thanks 4 ur great example...
View Tutorial          By: jithinraj at 2013-03-13 08:34:07

6. I writing a main class in the eclipse IDE and call
View Tutorial          By: adam lim at 2013-03-11 04:13:51

7. Getting coding from this is very easy to me...
View Tutorial          By: shanmugaraja at 2009-09-09 01:50:02

8. There are 11 types of people.
Those who kno

View Tutorial          By: alphachap at 2011-03-07 10:53:44

9. hi,
there is no main method in SMSClient.ja

View Tutorial          By: raju at 2010-01-22 08:28:45

10. Hi please help me out..

i am gettin

View Tutorial          By: sasivarnan at 2011-04-22 14:15:40