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. give an recursive example using string
View Tutorial          By: sauk at 2011-08-22 16:16:41

2. As soon as I added common-logging-1.1.1.jar My all
View Tutorial          By: shrawan kumar at 2011-10-30 12:06:50

3. Post your errors, so that others may help you my f
View Tutorial          By: yogesh at 2010-01-12 00:45:42

4. Good
View Tutorial          By: sandesh at 2009-10-01 01:15:29

5. This tutorial is very good. Actually I have been s
View Tutorial          By: farhaan at 2008-03-20 15:22:13

6. Hi Shreya, in Linux, the COM ports are identified
View Tutorial          By: Ramlak at 2008-06-23 03:34:11

7. #include<iostream>
#include<conio.

View Tutorial          By: XavioR at 2011-01-31 00:53:11

8. i want to know how to connect to a remote mysql da
View Tutorial          By: lixiang at 2013-04-23 04:32:58

9. So I appreciate this website, however... would it
View Tutorial          By: Christina at 2013-02-06 16:46:12

10. what is the usage of 'detail' and 'debug' init par
View Tutorial          By: uday at 2011-07-21 04:53:02