What is the output of the program ?
- class SampleExec1 {
- void run() {
- System.out.println("SampleExec1 run");
- }
- }
- class SampleExec2 extends SampleExec1 {
- void run() {
- System.out.println("SampleExec2 run");
- }
- }
- public class SampleExecution {
- public static void main(String[] args) {
- SampleExec2 ex = new SampleExec1();
- ex.run();
- }
- }
Output: compile time error at line 15. Type mismatch: cannot convert from SampleExec1 to SampleExec2
Comments
Post a Comment