-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest.java
More file actions
45 lines (36 loc) · 903 Bytes
/
Test.java
File metadata and controls
45 lines (36 loc) · 903 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 Computer {
Computer() {
System.out.println("Constructor of Computer class.");
}
void shutDown() {
System.out.println("Shuting down your PC soon...");
}
public static class Laptop {
private static int batteryPercentage;
Laptop() {
batteryPercentage = 90;
System.out.println("Constructor of Laptop class.");
}
void shutDown() {
System.out.println("Shuting down your PC soon...");
}
void batteryStatus() {
int i;
System.out.println( batteryPercentage +"% Battery available.");
{if (this.batteryPercentage > 80) {
System.out.println( "You are good!");
} else {
System.out.println( "Charge now.");
}}
// for (int i=0 ; i< 3; i++) {
//
// }
}
}
public static void main(String[] args) {
Computer my = new Computer();
Laptop your = new Laptop();
my.computer_method();
your.batteryStatus();
}
}