Originally Posted by
bugger
I am in need of an advice. I am designing my application and want to know when to use abstract class with static methods?
Abstract calls cannot be instantiated. If I don't declare the methods in Abstract class static, how can I call them?
Thanks.
--------
If I understand your question correctly, you simply need to extend the abstract class.
public abstract class AbstractExample {
public static void foo() {
System.out.println("Static foo called.");
}
public void bar() {
System.out.println("Non-static bar called.");
}
}
public class AbstractCaller extends AbstractExample {
public static void main(String[] args) {
AbstractCaller ac = new AbstractCaller();
ac.foo();
ac.bar();
}
}
Output:
Static foo called.
Non-static bar called.
Hope this helps, see
this Sun topic for more info.