Can you have a constructor in abstract class?
Answer Posted / sam
Yes
abstract class test{
int i=10;
abstract void method();
test(){
System.out.println("Abstract class constructor");
}
}
public class test1 extends test{
void method(){
//implement abstract method of test
}
public static void main(String args[]){
test1 t=new test1();
}
}
| Is This Answer Correct ? | 29 Yes | 2 No |
Post New Answer View All Answers
What is the difference between overriding & overloading?
What is generics in java interview questions?
What is java oops?
What are mutable classes?
Is cout buffered?
What is derived datatype?
What is the use of accept () method in java?
Explain the difference between jdk, jre, and jvm?
What is mutable object and immutable object?
Why do we need data serialization?
What is a flag value?
Can a variable be local and static at the same time?
What about member inner classes?
Can we override singleton class?
Where will it be used?