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. The DirSync sync intervals can be changed.

View Tutorial          By: Nitin at 2012-12-22 16:20:38

2. Very good
View Tutorial          By: take at 2010-03-29 07:47:01

3. Hi professional,
I tried the above code but

View Tutorial          By: Srinivas at 2008-05-05 23:32:13

4. sr
thanks 4 information provided
b

View Tutorial          By: veer kumar at 2012-07-25 18:30:38

5. This is a bad example, it does not check if the al
View Tutorial          By: Erik at 2011-02-12 07:16:20

6. Saved my life!
View Tutorial          By: Sahil Nair at 2013-09-21 09:26:54

7. it's good and very best
View Tutorial          By: rushikesh at 2014-02-04 11:28:42

8. # include <iostream.h>
void main()
View Tutorial          By: Ali Jafar at 2011-09-18 03:47:47

9. I am using MacOSX 10.5.4 and only enabling the mod
View Tutorial          By: Sachin at 2011-03-26 00:23:05

10. Your explanation is perfectly clear and not in nee
View Tutorial          By: Percy at 2009-06-08 14:14:39