Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
397 B
2
Indexable
Never
// test for explicit constructor call
class Person {
    int id;
	Person(int a)
	{
		id = a+1;
	}
}

class Employee extends Person{
    String name;
	Employee(int d, int c)
	{
		super(d);
		d = c+1;
		d++;
	}
}

class Vehicle {
    int maxSpeed = 120;
}
class Car extends Vehicle {
    int maxSpeed = 180;
 
    void display()
    {
        System.out.println("Maximum Speed: "+ maxSpeed);
    }
}