Question 151

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 () { }
}
public interface Drawable {
public abstract void draw ();
}
Which statement is true?
  • Question 152

    Given the code fragment:
    Map<Integer, String> books = new TreeMap<>();
    books.put (1007, "A");
    books.put (1002, "C");
    books.put (1001, "B");
    books.put (1003, "B");
    System.out.println (books);
    What is the result?
  • Question 153

    Given the code fragment:

    What is the result?
  • Question 154

    Given:

    And given the code fragment:

    What is the result?
  • Question 155

    Given:
    class UserException extends Exception { }
    class AgeOutOfLimitException extends UserException { }
    and the code fragment:
    class App {
    public void doRegister(String name, int age)
    throws UserException, AgeOutOfLimitException {
    if (name.length () < 6) {
    throw new UserException ();
    } else if (age >= 60) {
    throw new AgeOutOfLimitException ();
    } else {
    System.out.println("User is registered.");
    }
    }
    public static void main(String[ ] args) throws UserException {
    App t = new App ();
    t.doRegister("Mathew", 60);
    }
    }
    What is the result?