forked from ramram43210/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCarDemo.java
More file actions
52 lines (40 loc) · 1.08 KB
/
Copy pathCarDemo.java
File metadata and controls
52 lines (40 loc) · 1.08 KB
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
50
51
52
public class CarDemo
{
public static void main(String[] args)
{
/*
* Create maruthiAltok10 car object and
* set the properties
*/
Car maruthiAltok10 = new Car();
maruthiAltok10.setBrand("Maruthi Alto");
maruthiAltok10.setModel("k10");
maruthiAltok10.setColor("Orange");
displayCarInformation(maruthiAltok10);
/*
* Create swift car object and
* set the properties
*/
Car swift = new Car();
swift.setBrand("Swift");
swift.setModel("ZDI");
swift.setColor("Red");
displayCarInformation(swift);
/*
* Create maruthiAlto800 car object and
* set the properties
*/
Car maruthiAlto800 = new Car();
maruthiAlto800.setBrand("Maruthi Alto");
maruthiAlto800.setModel("800");
maruthiAlto800.setColor("Blue");
displayCarInformation(maruthiAlto800);
}
private static void displayCarInformation(Car car)
{
System.out.println("Car Brand : " + car.getBrand());
System.out.println("Car Model : " + car.getModel());
System.out.println("Car Color : " + car.getColor());
System.out.println("--------------------------------");
}
}