Can i have abstract class with no abstract methods?
Answer Posted / sitaram
yes,please find the below example.
abstract class AbstractClass1 {
public void method1(){
System.out.println("inside method1...");
}
}
class AbstractClass2 extends AbstractClass1{
public void method2(){
System.out.println("inside method2...");
}
}
public class AbstractDemo {
public static void main(String[] args) {
AbstractClass2 a = new AbstractClass2();
a.method1();
a.method2();
}
}
| Is This Answer Correct ? | 6 Yes | 2 No |
Post New Answer View All Answers
What is super constructor?
what is predefined function in java?
What is string pool?
Why doesn't the java library use a randomized version of quicksort?
How can we achieve thread safety in java?
What are java packages?
What are the different data types in java?
Explain about strings in java?
Explain the public class modifier?
How do you define a variable?
how does the run() method in runnable work? : Java thread
Why is logger singleton?
What is meant by inheritance and what are its advantages?
Difference between stack and queue?
How do I convert a string to an int in java?