Can I have constructor in Interface?

Answers were Sorted based on User's Feedback



Can I have constructor in Interface?..

Answer / saroj kumar biswal

no we can't have constructor in an interface, why bcz constructor is used to initialize the instance variable stored in an object. Constructor is called concurrently while creating object. We can't create object to interface & also we can't provide instance variable to interface. So we can't use constructor in an interface

Is This Answer Correct ?    30 Yes 3 No

Can I have constructor in Interface?..

Answer / suresh

No a interface should not have constructor,
Because, interface will not extends with object class.
if any class extends with object class then atleast one
constructor should be there, if user fail to keep the
constructor the compiler will keep a default constructor
with first statement as super();.

Is This Answer Correct ?    6 Yes 2 No

Post New Answer

More Core Java Interview Questions

What does the @override annotation do?

0 Answers  


List some important features of java 10 release?

0 Answers  


What is left shift and right shift?

1 Answers  


What is the purpose of void?

0 Answers  


What does 0 mean in boolean?

0 Answers  






What is emant by API? is it related to java only or it is common for all OOPS supporting language?

3 Answers  


State two differences between C and Java.

0 Answers   Syntel, Visa,


difference between String a; and String a=new String();? y do v need to assign memory to the variable?

2 Answers  


how to handled exceptions & erros in ejb?

1 Answers   Satyam,


Write an algorithm program in java for the following question.. 1) S is a set of integers.X is an integer obtained by sum of two digits in S. Write logic for whether or not the X is from the S. The time of algorithm should not exceed o(n logn).

0 Answers  


What is palindrome in java?

0 Answers  


how to print a numbers from 1 to 100 with out using control structures?

4 Answers   IBM,


Categories