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

Can we increase array size dynamically in java?

527


What is array and arraylist in java?

545


What is java and its types?

563


What is get () in java?

585


What is the mapping mechanism used by java to identify IDL language?

595






How do I type unicode?

546


I want to persist data of objects for later use. What’s the best approach to do so?

519


What is meant by data hiding/encapsulation?

583


What is preflight request?

548


What is a databasemetadata?

561


What is difference between wait and notify in java?

557


Can we declare a static variable inside a method?

546


Is arraylist an object in java?

617


What do you know about java?

541


What is array sorting in java?

563