In method overriding, the return type must be the same or a ________ of the superclass overridden method's return type.
- child
- different
- subclass
- superclass
In Java, when you override a method, the return type of the overriding method must be the same as or a subclass of the return type of the overridden method in the superclass. This is known as covariant return types.
Loading...
Related Quiz
- You are building a text editor in Java which reads large text files. How would you utilize character streams to read data from files, and why are character streams preferable in this scenario?
- What is the purpose of serialization in Java?
- The process of defining a new exception by extending an existing exception class is known as ________.
- Considering threading, which collection class might introduce higher overhead in managing read and write access?
- Which class would you use for reading binary data from a file?