Can I have constructor in Interface?
Answers were Sorted based on User's Feedback
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 |
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 |
What is tcp ip in java?
This abstract class is correct ? abstract class A { public abstract void Disp(); public abstract void B() { } public absract virtual C() { } }
Write a program to print all permutations of string?
Explain about GridBag Layout?
Explain what do you mean by functional overloading in java?
What is final modifier?
Explain about instanceof operator in java?
why java not supproting multiple inheritance?
how to use finalize()Method to resources
What is the difference between heap and stack memory?
What is constructor and its types?
what is a thread?