Skip to content

Commit b627a9e

Browse files
Add files via upload
1 parent 0cce48a commit b627a9e

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

Diff for: Superkeyword.java

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
class SuperA{
2+
void method1(){
3+
System.out.println("SuperA");
4+
}
5+
}
6+
class SubB extends SuperA{
7+
void method1(){
8+
super.method1();
9+
System.out.println("SubB");
10+
}
11+
}
12+
public class Main{
13+
public static void main(String[] args){
14+
SubB sb=new SubB();
15+
sb.method1();
16+
17+
18+
}
19+
20+
}

Diff for: parameterizedconstih.java

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
class SuperA{
2+
SuperA(){
3+
System.out.println("default constructor of super class");
4+
}
5+
SuperA(int x){
6+
System.out.println("parameterized constructor of super class with value: "+x);
7+
}
8+
}
9+
10+
class SubB extends SuperA{
11+
SubB(int x){
12+
super(145);//comment this line to see diff output
13+
System.out.println("parameterized constructor of sub class with value: "+x);
14+
15+
}
16+
}
17+
public class Main{
18+
public static void main(String[] args){
19+
SubB sb=new SubB(123);
20+
}
21+
}

0 commit comments

Comments
 (0)