Click here to watch in Youtube :
https://www.youtube.com/watch?v=tSVtLPh3X8o&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge
/* * Super class(Parent) */ class Vehicle { String vehicleType; } /* * Sub class(Child) */ public class Car extends Vehicle { String modelType; public void showDetail() { /* * accessing Vehicle class member. */ vehicleType = "Car"; modelType = "sports"; System.out.println(modelType + " " + vehicleType); } public static void main(String[] args) { Car car = new Car(); car.showDetail(); } }
sports Car
https://sites.google.com/site/javaee4321/java/InheritanceDemoVehicleApp.zip?attredirects=0&d=1
See also:
No comments:
Post a Comment