forked from avinashbest/java-coding-ninjas
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVehicle.java
More file actions
37 lines (29 loc) · 832 Bytes
/
Copy pathVehicle.java
File metadata and controls
37 lines (29 loc) · 832 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
package objectOrientedProgramming2;
public class Vehicle {
private String color;
protected int maxSpeed;
public Vehicle(String color, int maxSpeed) {
this.color = color;
this.maxSpeed = maxSpeed;
System.out.println("Vehicle's Constructor");
}
public Vehicle(int maxSpeed) {
System.out.println("Vehicle's Constructor");
this.maxSpeed = maxSpeed;
}
public void print() {
System.out.println("Inside Vehicle, " + "Color = " + color + ", Max Speed = " + maxSpeed);
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public int getMaxSpeed() {
return maxSpeed;
}
public void setMaxSpeed(int maxSpeed) {
this.maxSpeed = maxSpeed;
}
}