Given a sample code:
1 class Test {
2 void printTest() {
3 System.out.println("superclass");
}}
4 class Sample1 extends Test {
5 Sample1() {
6 super.printTest();
}
7 public static void main(String args[]) {
8 new Sample1();
}}
What will be the result of above code ?
(1) Compilation fails because of an error on line 6
(2) Compilation fails because of an error on line 8
(3) Compilation fails because of an error on line 3
(4) Compile and run successfully with no error
(4)
It has no issue with the code. It will display the output on console.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.