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. thank's
View Tutorial          By: gerald at 2010-08-06 01:21:39

2. Verrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
View Tutorial          By: Amarnath.A at 2011-07-14 00:32:08

3. it very useful to under stand
View Tutorial          By: gurav gupta at 2009-09-24 00:20:15

4. #include<iostream>
#include<conio.

View Tutorial          By: Zohaib Farooq at 2011-05-23 07:58:44

5. hiiiii
View Tutorial          By: hiiiiii at 2010-07-28 14:08:50

6. hey thats a superb way of explaining in plain term
View Tutorial          By: Agastya at 2011-05-08 03:11:53

7. Good and very clear explanation...
View Tutorial          By: Pavana at 2010-01-05 23:35:30

8. Great work ;)
View Tutorial          By: Rizwanulla Sharieff at 2012-08-21 04:42:41

9. I need to creat class. Write in class void named r
View Tutorial          By: Aliarth at 2012-11-18 00:03:15

10. This should save some time

class pa

View Tutorial          By: vamsi gude at 2012-03-20 18:27:24