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. Very concise, but it would be more helpful without
View Tutorial          By: Randy at 2010-11-17 14:16:01

2. Norman, it would be good to credit where your writ
View Tutorial          By: K&R at 2014-03-20 11:41:56

3. please help me on "why subclass of stack is
View Tutorial          By: mahendra at 2012-12-15 03:39:22

4. Hello to Every one!! :-),HERE I'AM NOT WRITING A C
View Tutorial          By: Pulkit Malviya at 2012-08-26 14:56:18

5. To determine current location in a file:
{<

View Tutorial          By: Terry at 2009-09-27 13:15:56

6. Thanks for example..
But I have the same p

View Tutorial          By: Lina at 2009-05-02 13:23:33

7. it should be:
/* --------------- */

View Tutorial          By: Ryba at 2010-05-19 15:45:48

8. Dear All , I have query reg hibernate with WAS /WP
View Tutorial          By: pmr at 2011-07-18 02:58:08

9. thanks nice article , but there is bug as already
View Tutorial          By: YZ at 2011-08-05 13:10:49

10. I want to enter data from a textbox to recordstor
View Tutorial          By: Rahul Maurya at 2010-04-10 01:04:51