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


Please Help Members By Posting Answers For Below Questions

What does the string method compareto () do?

531


Is string is a class in java?

513


what are three ways in which a thread can enter the waiting state? : Java thread

568


How do you make a thread in java?

622


Explain about anonymous inner classes ?

568






What is the difference between public, private, protected, and friend access?

566


Explain about public and private access specifiers?

526


what is a thread pool in java and why is it used?

522


Explain the pointers in Java?

588


What are the advantages of java over cpp?

543


Explain the differences between static and dynamic variables?

578


What is a war file?

534


Why is stringbuffer faster than string?

480


What is a variable simple definition?

572


What is method and methodology?

597