What is the output of the program ?



  1. class SampleExec1 {
  2. void run() {
  3. System.out.println("SampleExec1 run");
  4. }
  5. }

  6. class SampleExec2 extends SampleExec1 {
  7. void run() {
  8. System.out.println("SampleExec2 run");
  9. }
  10. }

  11. public class SampleExecution {
  12. public static void main(String[] args) {
  13. SampleExec2 ex = new SampleExec1();
  14. ex.run();
  15. }
  16. }
Output: compile time error at line 15. Type mismatch: cannot convert from SampleExec1 to SampleExec2

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation