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
Why do we use variables?
Can extern variables be initialized?
Write a program to print 15 random numbers using foreach of java 8?
Write a program to check for a prime number in java?
What are the features of java?
What is the console in java?
what is abstract class in Java?
What is the difference between declaration and definition in java?
Why generics are used in java?
What is a variable in java?
What is difference between wait and notify in java?
If a variable is declared as private, where may the variable be accessed?
Why are parameters used in functions?
Which package is imported by default?
How do you compare arrays in java?