Exam Prep Practice Questions

Question 1 You are working on an aquarium-simulation class named Aquarius. You already have a method that adds a Fish object to the aquarium and returns the remaining fish capacity. This method has the following declaration:
public int addFish( Fish f )

Now you want to provide for adding a whole school of fish at once. The proposed method declaration is as follows:

protected boolean addFish( Fish[] f )

The idea is that it will return true if there is more room in the tank or false if the tank is too full. Which of the following statements about this proposal are true?

  • A. This technique is called overloading.

  • B. This technique is called overriding.

  • C. The compiler will reject the new method because the return type ...

Get Java 2™ Programmer Exam Cram™ 2 (Exam CX-310-035) now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.