hi,
Can a abstract class be defined without any abstract methods?
thanks,
Hi friend,
Yes, we can create an abstract class without declaring any abstract methods.
Following code snippet shows how you can create an abstract class without any abstract methods.
public abstract class AbstractClass { public String getName() { return "RoseIndia"; } } public class Test extends AbstractClass { public static void main(String args[]) { Test test = new Test(); String name = test.getName(); System.out.println("\n"+name); } }
Hi,
Yes, you can create abstract class without any abstract methods. Doing so, there is no need to create an instance of the class and we can access its methods.