can a class without abstract method named abstract code example

Example 1: can you declare an abstract method in a non abstract class

No. A normal class(non-abstract class) cannot have abstract methods.

Example 2: can we have abstract class having no abstract method in java?

abstract class AbstractDemo { // Abstract class
   private int i = 0;
   public void display() { // non-abstract method
      System.out.print("Welcome to Tutorials Point");
   }
}
public class InheritedClassDemo extends AbstractDemo {
   public static void main(String args[]) {
      AbstractDemo demo = new InheritedClassDemo();
      demo.display();
   }
}

Tags:

Java Example