-
Notifications
You must be signed in to change notification settings - Fork 123
Expand file tree
/
Copy pathCar.java
More file actions
37 lines (28 loc) · 719 Bytes
/
Car.java
File metadata and controls
37 lines (28 loc) · 719 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
public class Car {
String model;
String color;
int horsePower;
static final byte NO_OF_WHEELS = 4;
static byte noOfEngines;
static {
noOfEngines = 1;
System.out.println("static blocking is being executed");
}
{
System.out.println("Car object is being created....");
}
public Car () {
}
public Car (String model, String color, int horsePower) {
this.model = model;
this.horsePower = horsePower;
this.color =color;
}
public void startCar( ) {
System.out.println("Vehicle started...");
}
public String stopCar( ) {
String output = "Vehicle stopped...";
return output;
}
}