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 the maximum size of hashmap in java?
What is the difference between the jdk 1.02 event model and the event-delegation model introduced with jdk 1.1?
What is a default constructor and also define copy contrucyor?
Why vector is used in java?
What is the default size of load factor in hashing based collection?
What is the use of beaninfo?
Name few "optional" classes introduced with java 8 ?
Difference between string s= new string (); and string s = "abv";?
What are the two ways in which thread can be created?
Is there any case when finally will not be executed?
How do you reverse a string in java?
How can you make a class serializable in java?
List some oops concepts in java?
When do you get classcastexception?
What are 5 boolean operators?