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. Thanks. A couple of typos, though:
- &quo

View Tutorial          By: Steve Parker at 2013-09-25 09:47:08

2. realy i enjoy it for visit your site. and i unders
View Tutorial          By: vinod balot at 2015-02-09 17:43:30

3. Hi Friends,

I got a very interestin

View Tutorial          By: Rohit Kapur at 2011-07-27 20:56:57

4. hi guys.
i have downloaded the code for sen

View Tutorial          By: Tabrez Ansari at 2012-09-13 11:03:46

5. This can also prevent Outlook from using the autod
View Tutorial          By: Morgster79 at 2012-03-21 05:07:42

6. You have mentioned that
to use this program

View Tutorial          By: Naasik at 2012-08-05 00:15:57

7. i want to SCJP exam ,tell how to apply for this ex
View Tutorial          By: jasmina at 2013-04-22 11:05:53

8. Good and optimum introduction to J2ME application
View Tutorial          By: [email protected] at 2013-01-14 10:37:57

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

10. nice intelligent work
View Tutorial          By: santosh at 2010-11-28 01:18:50