super(brand, model); } public void displayInfo() { System.out.println("Bike Brand : " + brand + "Model is : " + model ); } }
class Car extends Vehicle {
public Car(String brand, String model) {
super(brand, model);
} public void displayInfo() { System.out.println("Car Brand : " + brand + "Model is " + model); } }
public class AbstractClass {
public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter the Bike Brand:"); String bike_brand = sc.nextLine(); System.out.println("Enter the Bike Model:"); String bike_model = sc.nextLine(); System.out.println("Enter the Car Brand:"); String car_brand = sc.nextLine(); System.out.println("Enter the Car Model:"); String car_model = sc.nextLine();
Vehicle myBike = new Bike(bike_brand , bike_model);