Exam 1z0-809 All QuestionsBrowse all questions from this exam
Question 176

Given:

public class Canvas implements Drawable {

public void draw () { }

}

public abstract class Board extends Canvas { }

public class Paper extends Canvas {

protected void draw (int color) { }

}

public class Frame extends Canvas implements Drawable {

public void resize () { }

abstract void open ();

}

public interface Drawable {

public abstract void draw ();

}

Which statement is true?

    Correct Answer: C

    The class Frame does not compile because it is not declared as abstract but contains an abstract method open(). In Java, any class that has one or more abstract methods must itself be declared abstract. Therefore, Frame must either be declared abstract, or the open method must be provided a concrete implementation for Frame to compile.

Discussion
jduarteOption: C

answer is C. the class Frame is not abstract then open method open can´t abstract.

MatthewTannousOption: B

Both B&C , B-> overwriting a public method with a protected method, C-> Frame is not abstract class

steefaandOption: C

C is true as nonabstract class can't have abstract methods.

lchowenOption: C

Answer is C. B is wrong because if you read carefully, Paper class overloads the draw method with draw(int color). It's not overriding the draw() method. So paper class compiles