Professional Documents
Culture Documents
Super Keyword Worksheet: Consider The Following Classes
Super Keyword Worksheet: Consider The Following Classes
Worksheet
public class First public class Second extends First public class Third extends Second
{ { {
public void methodOne() public void methodOne() public void methodOne()
{ { {
System.out.print("1"); super.methodOne(); System.out.print("X");
} System.out.print("A"); super.methodOne();
} }
public void methodTwo()
{ public void methodTwo() public void methodTwo()
methodOne(); { {
System.out.print("2"); super.methodTwo(); System.out.print("Y");
} System.out.print("B"); super.methodTwo();
} }
} } }
Assume the following declarations.
1. f1.methodOne(); ________
2. f1.methodTwo(); ________
3. f2.methodOne(); ________
4. f2.methodTwo(); ________
5. f3.methodOne(); ________
6. f3.methodTwo(); ________