-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram_20.java
45 lines (38 loc) · 1.17 KB
/
Program_20.java
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
/*
* Description : This program is to demonstrate the use of getters.
* Author : Mr. Rabbit
*/
public class Program_20 {
public static void main(String[] args) {
Television t = new Television("Sony", 26, "Color", "23-11-2022");
System.out.println("Television Details:\n");
System.out.println("Television Brand: " + t.getMaker());
System.out.println("Television Size: " + t.getSize() + " inch");
System.out.println("Television Color: " + t.getColor());
System.out.println("Television Date of Purchase: " + t.getDateOfPurchase());
}
}
class Television {
private String maker;
private int size;
private String color;
private String dateOfPurchase;
public Television(String maker, int size, String color, String dateOfPurchase) {
this.maker = maker;
this.size = size;
this.color = color;
this.dateOfPurchase = dateOfPurchase;
}
public String getMaker() {
return maker;
}
public int getSize() {
return size;
}
public String getColor() {
return color;
}
public String getDateOfPurchase() {
return dateOfPurchase;
}
}