-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathunderstanding_class.java
More file actions
66 lines (55 loc) · 1.19 KB
/
understanding_class.java
File metadata and controls
66 lines (55 loc) · 1.19 KB
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
56
57
58
59
60
61
62
63
64
65
66
import java.io.*;
class StudentMarks{
public int x;
public int y;
public StudentMarks(int a1,int a2){
System.out.println("Hello");
x=a1;
y=a2;
}
public StudentMarks(){
System.out.println("kuch nahi hai");
}
public StudentMarks(int a1){
System.out.println("single vaue");
x=a1;
}
}
class understanding_class{
public static void main(String[] args) {
StudentMarks a1=new StudentMarks(50,20);
StudentMarks a2=new StudentMarks(40,100);
StudentMarks a3=new StudentMarks();
StudentMarks a4=new StudentMarks(100);
// a1.x=100;
// a1.y=500;
// a2.x=500;
// a2.y=100;
System.out.println(a1.x+a2.x);
System.out.println(a4.x);
}
}
// class Demo {
// public int x;
// public int y,z;
// void fun(){
// System.out.println("fun fun fun");
// }
// }
// class understanding_class{
// public static void main (String[] args) {
// Demo obj=new Demo();
// Demo obj1=new Demo();
// obj.x=12;
// obj.y=13;
// obj.z=14;
// obj1.x=200;
// obj1.y=100;
// System.out.println(obj.x);
// System.out.println(obj.y);
// System.out.println(obj.z);
// System.out.println(obj1.x);
// System.out.println(obj1.y);
// obj.fun();
// }
// }