-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComputer.java
More file actions
41 lines (32 loc) · 752 Bytes
/
Computer.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
package homework2;
public class Computer {
//Static variable
public static int numbers;
//Non-Static variable
public String Type;
//Constructor
Computer(){
this.Type = " Windows,Macs,Linux " ;
}
// Constructor with parameter
Computer(int numbers, String Type){
this.numbers = numbers;
this.Type = Type;
}
// Non-Static Method
public void totalNumbers(int numbers) {
this.numbers = numbers;
}
//Non-Static method
public int count() {
return numbers;
}
//Static Method
public static void component() {
System.out.println(" Hey, All components are working fine ");
}
// Static Method
void display(){
System.out.println(" Number of Computer :" + numbers+ " Machine Type :" + Type);
}
}