View RSS Feed

Java Object

Object-oriented programming in Java.

  1. Returning a Class or Interface

    by , 04-26-2012 at 05:39 PM
    When a class name is used by a method as its return type, like whosFastest would be doing, typeís class of returned objects shall be subclass or exact class of return type. Letís say that class hierarchy is there where java.lang.Number has a subclass ImaginaryNumber that is also the Objectís subclass that has been illustrated in figure given below:

    Name:  1.jpg
Views: 316
Size:  3.1 KB

    ImaginaryNumberís class hierarchy

    Letís say a method has been declared so that ...