

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This lecture was delivered by Prof. Mudita Tiwari at Cochin University of Science and Technology for Java Programming course. It includes: Implementation, Signature, Class, Interfaces, Modifiers, Public, Behavior, Console
Typology: Lecture notes
1 / 2
This page cannot be seen from the preview
Don't miss anything!


public interface IVehicle { void Start(); void Drive(); void Park(); void ChangeGear(int gear); } public class Vehicle : IVehicle { public void Start() { Console.WriteLine("The vehicle has been started"); } public void Drive() { Console.WriteLine("The vehicle is being driven"); } public void Park() { Console.WriteLine("The vehicle is being parked"); } public void ChangeGear(int gear) { Console.WriteLine("Gear changed to " + gear.ToString()); } } public abstract class Vehicle { public void Start()
Console.WriteLine("The vehicle has been started"); } public abstract void Drive(); public abstract void Park(); public abstract void ChangeGear(int gear); public void SwitchOff() { Console.WriteLine("The vehicle has been switched off"); } } public class Car : Vehicle { public Car() { } public override void Drive() { Console.WriteLine("The car is being driven"); } public override void Park() { Console.WriteLine("The car is being parked"); } public override void ChangeGear(int gear) { Console.WriteLine("The car changed gear changed to " + gear.ToString()); } }