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
When should I use singleton?
What is java’s garbage collected heap?
Can we declare a class as static?
what is the messsage u r going to get from an objectoriented programing?
What do you know about java?
what happens when a thread cannot acquire a lock on an object? : Java thread
Why can't we override private static methods?
what is instanceof operator used in java?
What is the difference between checked exception and unchecked exception?
How do I run java on windows?
What are the difference between composition and inheritance in java?
What are the differences between getting and load method?
Explain the differences between abstraction and encapsulation?
Can we override the private methods?
What is the SimpleTimeZone class?