» » Can you define an abstract class without any abstract methods? if yes what is the use of it?

  • 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");
    }

    }


Instance Of Java

We will help you in learning.Please leave your comments and suggestions in comment section. if you any doubts please use search box provided right side. Search there for answers thank you.
«
Next
Newer Post
»
Previous
Older Post

2 comments for Can you define an abstract class without any abstract methods? if yes what is the use of it?

  1. But in what scenarios defining an abstract class without abstract methods will be useful ?

    ReplyDelete

Select Menu