156k views
3 votes
Suppose the abstract class Message is defined belowpublic abstract class Message{private String value;public Message(String initial){value = initial;}public String getMessage(){return value;}public abstract String translate();}A concrete subclass of Message, called FrenchMessage, is defined. Which methods must FrenchMessage define?

User Grigori
by
3.4k points

1 Answer

6 votes

Answer:

The answer is "translate() only".

Explanation:

In the given statement some information is missing, which is the option of the question, that can be defined as follows:

A) translate() only.

B) getMessage() only.

C) The FrenchMessage constructor and translate() only

D) The FrenchMessage constructor, getMessage(), and translate().

In the given statement, only translate() method is used, because in the statement it is declared that, it is an abstract method, which is only declared in the class not defined, that's why option a is correct and other were wrong, which can be explained as follows:

  • In option B, this method is used to return copy constructor value, that's why it is wrong.
  • Option C and Option D is wrong because it uses other methods.
User Joshua Goossen
by
3.0k points