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 final keyword in java? Give an example.
What is method with example?
How to display names of all components in a Container?
Can a abstract class be declared final?
2) Suppose there are 5 directories having lot of files (say txt files) in each directory. 2 things :- 2.1) You want to search for filenames which have a particular pattern. 2.2) Out of these filtered files you want to search for a particular keyword or a search string. How can you achieve this?
What is %d in printf?
Explain how hashmap works?
Can we serialize static variables in java?
Explain about the interpreter in java?
What is a null class?
how is final different from finally and finalize in java?
What is continuity of a function?
What do the thread?class methods run() and start() do?
What are the different types of data structures in java?
What is the purpose of the strictfp keyword?