forked from Kartikey0205/Colege-JavaLab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathp010this.java
More file actions
39 lines (32 loc) · 891 Bytes
/
p010this.java
File metadata and controls
39 lines (32 loc) · 891 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
class Test1 {
int a, b;
Test1() {
this(10);
System.out.println("I am from default");
a = 1;
b = 2;
System.out.println("Val of a = " + a);
System.out.println("Val of b = " + b);
}
Test1(int x) {
this(100, 200);
System.out.println("I am from single parameter");
a = b = x;
System.out.println("Val of a = " + a);
System.out.println("Val of b = " + b);
}
Test1(int a, int b) {
System.out.println("I am from double parameter");
this.a = a;
this.b = b;
System.out.println("this.a is " + this.a);
System.out.println("this.b is " + this.b);
System.out.println("a is " + a);
System.out.println("b is " + b);
}
}
public class p010this {
public static void main(String args[]) {
Test1 t1 = new Test1();
}
}