forked from natural/java2python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCtor2.java
More file actions
28 lines (22 loc) · 512 Bytes
/
Ctor2.java
File metadata and controls
28 lines (22 loc) · 512 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
class Ctor2 {
public int x = 1;
public String y = null;
public Ctor2() {
x = 2;
}
public Ctor2(int arg) {
x = arg;
}
public Ctor2(String arg) {
y = arg;
}
public static void main(String[] args) {
Ctor2 t1 = new Ctor2();
System.out.println(t1.x);
Ctor2 t2 = new Ctor2(3);
System.out.println(t2.x);
Ctor2 t3 = new Ctor2("notnull");
System.out.println(t3.x);
System.out.println(t3.y);
}
}