-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest.java
More file actions
38 lines (38 loc) · 706 Bytes
/
Test.java
File metadata and controls
38 lines (38 loc) · 706 Bytes
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
import java.util.*;
public class Test{
public static void main(String[] args){
Cost c = new Cost("530","Audi",530000);
c.costInfo();
c.vehicleInfo();
c.brandInfo();
}
static class Vehicle{
String vname;
Vehicle(String vname){
this.vname=vname;
}
void vehicleInfo(){
System.out.println(vname);
}
}
static class Brand extends Vehicle{
String bname;
Brand(String vname,String bname){
super(vname);
this.bname=bname;
}
void brandInfo(){
System.out.println(bname);
}
}
static class Cost extends Brand{
int cost;
Cost(String vname,String bname,int cost){
super(vname,bname);
this.cost=cost;
}
void costInfo(){
System.out.println(cost);
}
}
}