Given below the sample code :
class mainClass {
void process() throws Exception {
throw new Exception();
}
}
class sub extends mainClass {
void process() {
System.out.println("sub class");
}
}
class except {
public static void main(String[] args) {
mainClass m = new sub();
m.process();
}
}
What will be the output of the above code ?
1. No output
2. sub main
3. Compilation fails.
4. class sub
(3)
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.