Home
›
Can you define an abstract class without any abstract methods? if yes what is the use of it?
Posted by: InstanceOfJava
Posted date:
Dec 3, 2014
/
- Yes.
- Declaring a class abstract without abstract methods means that you don't allow it to be instantiated on its own.
- The abstract class used in java signifies that you can't create an object of the class directly.
- This will work:
public abstract class abs {
protected int s=0;
public void display() {
System.out.print("hello");
}
}
Tagged with:
Java Programs
Instance Of Java
We are here to help you learn! Feel free to leave your comments and suggestions in the comment section. If you have any doubts, use the search box on the right to find answers. Thank you! 😊
which means concrete method???
ReplyDeleteBut in what scenarios defining an abstract class without abstract methods will be useful ?
ReplyDelete