Question: 9. Given the following code, what is the output? public class Figure ! public class Line extends Figure public void display ( [ public void
9. Given the following code, what is the output? public class Figure ! public class Line extends Figure public void display ( [ public void display ( ) System.out.print("Figure"); System.out.print("Line"); } } public class Inherit { public static void tryme (Figure f) { f.display ( ); } public static void main(String[] args) { Figure f = new Figure(); Line in new Line(); fln; tryme (f); a Line b. Figure c. FigureLine d. Compilation error e. None of the above c h le0-5. inclusive in 10. Why does the code in the following method represent an infinite recursion? public int infinite Recursion (int n) { if (n > 0) return infiniteRecursion (n) + 1; else return 0; a. Because there is no base case b. Because the recursive call does not move the parameter closer to the base case c. Because the recursive call moves the problem further away from the base case d. Because there is no recursive call e. None of the above
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
