can i define a class abstract with no abstract method in it?

Yes, we can create concreate method in the abstract class. To prevent a class from directly creating objects, it is better declare that as abstract classes. As HttpServlet.

					abstract class Hello {
	public void test() {
		System.out.println("abstract class without abstract method");

public class ExampleHello extends Hello {
	public static void main(String[] args) {
		Hello d = new ExampleHello();

Output :-
abstract class without abstract method

Leave a Comment

Your email address will not be published. Required fields are marked *