Skip to content

Commit 04d61c7

Browse files
this and super keyword in Java
1 parent a747e3e commit 04d61c7

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

47.this_and_super_keyword/cwh.java

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
class cwh{
2+
int x;
3+
4+
// getter of x
5+
public int getX(){
6+
return x;
7+
}
8+
9+
// Constructor with a parameter
10+
cwh(int x) {
11+
x = x;
12+
}
13+
14+
// Call the constructor
15+
public static void main(String[] args) {
16+
cwh obj1 = new cwh(65);
17+
System.out.println(obj1.getX());
18+
19+
}
20+
}

0 commit comments

Comments
 (0)