Submitted Questions

  • final method

    having said a final method can be overloaded(default in d same class) plz explain me if there is anything missing in this code ? class Base { public final doSomething(Object o) { System.out.println("Object"); } } class Derived extends Base { public doSomething(Integer i) { System.out.println("Int"); } } public static void main(String[] args) { Base b = new Base(); ...

    santhosh

    • Feb 23rd, 2012

    In the main method,you simply change the "base d" as "Derived d" you get "object" and "int" as a output.also returned type is required.