-
Notifications
You must be signed in to change notification settings - Fork 4
/
practice_1.java
49 lines (49 loc) · 901 Bytes
/
practice_1.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
class Car
{
Car()
{
System.out.println("This is a Car");
}
void vehicleType()
{
System.out.println("This is a sports Car");
}
}
class Lambo extends Car
{
Lambo()
{
System.out.println("This is Lambo");
}
void brandName()
{
System.out.println("This brand is Lambo");
}
void speed()
{
System.out.println("Speed limit is 350km/hr");
}
}
class Aventador extends Lambo
{
Aventador()
{
System.out.println("This Car is Aventador");
}
void speed()
{
System.out.println("Max speed is 400km/hr");
}
}
public class practice_1
{
public static void main(String args[])
{
Aventador a=new Aventador();
a.vehicleType();
a.brandName();
a.speed();
Lambo l=new Lambo();
l.speed();
}
}