Assume that a File is an abstract class and has toFile() method. ImageFile and BinaryFile are concrete classes of the abstract class File.

Also, assume that the method toFile() is implemented in both Binary File and Image File. Which implementation method will be called when a File references an ImageFile object in memory and the toFile method is called?

Options
- Binary File
- Image File
- Both File and Binary Files
- None of the above


CORRECT ANSWER : Image File

Discussion Board
good question

whenever we create an object of concrete class(ImageFile) of type (abstarct class), first the JVM looks for the existance of toFile() in base class(Abstract class) if existed then control goes to reference what oject contains and the refered class method only executed.

Nikhil V 08-25-2016 10:23 AM

Implementation to be called for ImageFile object

ImageFile class will be called to execute the ImageFile object as binary file can't handle executable formats so whenever an Image file of any format is called ImageFile function will be used. ImageFile classes are specially used to call an Image object.

Rohit Sharma 07-26-2014 07:09 PM

Write your comments


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement