is it necessary for abstract class to have abstract method
Abstract classes CAN have non-abstract methods.
is it necessary for abstract class to have abstract method
Abstract classes CAN have non-abstract methods.
can abstract class have non abstract methods 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();
}
}
can you declare an abstract method in a non abstract class
No. A normal class(non-abstract class) cannot have abstract methods.
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us