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 causes memory leak in java?
What are inbuilt functions?
How many bits is a word?
How do you declare an empty string?
What is Java Reflection API? Why it’s so important to have?
What interface is extended by awt event listeners?
What is thread pool? How can we create thread pool in java?
What is a numeric literal?
Can substring create new object?
What about abstract classes in java?
Is main an identifier?
Describe different states of a thread.
What are java packages?
Is Java a dying language?
Why string is not a wrapper class?