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. how can i give me a assign value to mutldimentiona
View Tutorial          By: shinde datta at 2013-01-12 10:41:15

2. Simple and straight to the point. Thank you.
View Tutorial          By: Barbara at 2008-03-21 10:02:47

3. Sir. Please give an example which is small and und
View Tutorial          By: Rafik at 2011-08-17 19:45:04

4. Managing several submissions can be a lot more sim
View Tutorial          By: Curran Cline at 2012-12-18 05:43:44

5. The code gives the following exception :-
<

View Tutorial          By: anju at 2014-03-15 07:02:18

6. well an easy code to understand
thanks muc

View Tutorial          By: narmada at 2011-01-17 09:47:02

7. very nice notes we are easy to understand this not
View Tutorial          By: maalu at 2013-04-29 07:06:56

8. Hi! Thanks for the examples posted here...it reall
View Tutorial          By: creece at 2009-01-23 17:28:33

9. It is clear and understandable for beginners.

View Tutorial          By: Archana at 2011-12-14 12:31:21

10. I got Error...Why it is happen..??


View Tutorial          By: Dineth at 2011-07-15 16:54:31