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



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. hello!!can anyone help me. can you send me the com
View Tutorial          By: denisse at 2008-01-07 05:40:25

2. this is good, but i need a simple program about sh
View Tutorial          By: ramalakshmi at 2011-01-05 03:38:26

3. It work fine with message below 160 chars. How can
View Tutorial          By: Milind at 2011-12-15 06:20:33

4. Thanks for this tuto , simple and very useful :)
View Tutorial          By: Firas at 2014-11-24 16:49:07

5. Can we use the if sttmt l;ike this::
if (a

View Tutorial          By: Anubhav at 2010-11-14 08:15:04

6. Hi,
Its good but you can make it more bette

View Tutorial          By: vishakha sharma at 2010-12-15 06:14:52

7. Good Example esp. way it was presented.
View Tutorial          By: Arunlal at 2013-06-20 11:56:43

8. Thanks!
Please point me to a site which di

View Tutorial          By: TERRY DEGLOW at 2012-01-29 16:04:41

9. class Foo implements Runnable{


View Tutorial          By: DeeNKHAN at 2013-03-02 06:54:13

10. i am try this codeing in vb . i am using nokia n73
View Tutorial          By: kanyaraj at 2010-02-09 19:10:10