Search for question
Question

1. Consider the following code.

class Class1 {

final public void to_Output () {

System.out.println("This is in Class1");

}

}

class Class2 extends Class1 {

public void to_Output () {

System.out.println("This is in Class2");

}

}

}

class Main {

public static void main(String[] args) {

Class1 b = new Class2 () ;;

b.to_Output ();

}

What is the output of the code? Justify your answer

Fig: 1