-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVehicle.java
More file actions
45 lines (44 loc) · 759 Bytes
/
Vehicle.java
File metadata and controls
45 lines (44 loc) · 759 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
39
40
41
42
43
44
45
class Vehicle
{
int Speed;
int Milege;
void setSpeed(int sp)
{
this.Speed=sp;
}
void setMilege(int m)
{
Milege=m;
}
void display()
{
System.out.println("Speed"+Speed+"Milege"+Milege);
}
}
class Bike extends Vehicle
{
int SeatHeight;
int Engine;
void setData(int sh,int eng,int s,int m)
{
super.setSpeed(s);
super.setMilege(m);
SeatHeight=sh;
Engine=eng;
}
void display()
{
super.display();
System.out.println(SeatHeight);
System.out.println(Engine);
}
}
class Demo
{
public static void main(String args[])
{
Bike b=new Bike();
b.setData(10,20,30,40);
b.display();
}
}