37
Answer (Choose 1 answer)
A. Compilation error in line (1)
B. Compilation error in line (3)
C. Compilation error in line (2)
D. 3
}
}
What will be the output of following code?
interface Eating{
public void getHour();public int getMeals();}
abstract class Meal implements Eating{ // (1)
public void getHour(){System.out.println(getMeals());}
} public class Main1 {
public static void main(String[] args) {
Eating e=new Meal() { // (2)
@Override
public int getMeals() {
return 3;
}
};e.getHour();// (3)