-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain(4).java
More file actions
33 lines (26 loc) · 783 Bytes
/
main(4).java
File metadata and controls
33 lines (26 loc) · 783 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
//4. Create CPU with attribute price. Create inner class Processor (no. of cores, manufacturer)
and static nested class RAM (memory, manufacturer). Create an object of CPU and print
information of Processor and RAM.//
class CPU {
int price = 20000;
class processor {
int no_cores = 1000;
String manufacturer = "intel";
static class ram{
int memory=128;
String manufacturer = "AMD";
}
}
}
public class main {
public static void main(String[] args) {
CPU a = new CPU();
CPU.processor b = a.new processor();
CPU.processor.ram c = new CPU.processor.ram();
System.out.println(a.price);
System.out.println(b.no_cores);
System.out.println(b.manufacturer);
System.out.println(c.memory);
System.out.println(c.manufacturer);
}
}