- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComputer.java
More file actions
Latest commit
41 lines (32 loc) · 752 Bytes
/
Copy pathComputer.java
File metadata and controls
41 lines (32 loc) · 752 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
packagehomework2;
publicclassComputer {
//Static variable
publicstaticintnumbers;
//Non-Static variable
publicStringType;
//Constructor
Computer(){
this.Type = " Windows,Macs,Linux " ;
}
// Constructor with parameter
Computer(intnumbers, StringType){
this.numbers = numbers;
this.Type = Type;
}
// Non-Static Method
publicvoidtotalNumbers(intnumbers) {
this.numbers = numbers;
}
//Non-Static method
publicintcount() {
returnnumbers;
}
//Static Method
publicstaticvoidcomponent() {
System.out.println(" Hey, All components are working fine ");
}
// Static Method
voiddisplay(){
System.out.println(" Number of Computer :" + numbers+ " Machine Type :" + Type);
}
}