-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobjects.java
More file actions
55 lines (45 loc) · 1003 Bytes
/
objects.java
File metadata and controls
55 lines (45 loc) · 1003 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
46
47
48
49
50
51
52
53
54
55
<<<<<<< HEAD
class A {
int x = 10;
}
class B {
int y = 20;
}
class C {
int z = 30;
}
public class objects {
public static void main(String[] args) {
// Creating objects
A obj1 = new A();
B obj2 = new B();
C obj3 = new C();
// Accessing variables
System.out.println("Value of x = " + obj1.x);
System.out.println("Value of y = " + obj2.y);
System.out.println("Value of z = " + obj3.z);
}
}
=======
class A {
int x = 10;
}
class B {
int y = 20;
}
class C {
int z = 30;
}
public class objects {
public static void main(String[] args) {
// Creating objects
A obj1 = new A();
B obj2 = new B();
C obj3 = new C();
// Accessing variables
System.out.println("Value of x = " + obj1.x);
System.out.println("Value of y = " + obj2.y);
System.out.println("Value of z = " + obj3.z);
}
}
>>>>>>> 88d54c5 (hellooooo)