Tuesday, September 30, 2008

Java Abstract Methods : Return type

Consider an abstract class declaring an abstract method. Let the return type of the method be Object. Now lets say, a class extends this abstract class and defines this method. What should be the return type of this method to override the base abstract method? ;D, it can be anything!!

public abstract class AbstractClassA{
    public abstract Object getDataForDoingSomething();

public abstract class SClassA extends AbstractClassA{
    public List getDataForDoingSomething() {           
                return new ArrayList();


  1. I thought this can be used and i configured in the log4j.xml, but only to my disappointment log4j does not recognize elements rollingPolicy and triggeringPolicy. But there DTD, log4j.dtd, had these elemets.
    So, there was nothing about the rollingPolicy or triggeringPolicy, though there DTD defines them.



    I had exactly the same problem which I fix by upgrading log4j.jar to 1.2.15 (previously I had 1.2.13).

    Now log4j recognize rollingPolicy...
    So much for backward compatibility :o)


  2. :) I think you posted on wrong post.