Can I have constructor in Interface?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is array and arraylist in java?

523


What are design patterns and please explain?

566


What does \ mean in regex?

619


Do I need java on my computer?

524


Is alive and join method in java?

533






What is singleton class and how can we make a class singleton?

657


How to disable caching on back button of the browser?

522


Can long be null in java?

540


How to implement a multithreaded applet?

2199


What are the library functions in java?

542


Why can't we override private static methods?

512


What is boolean flag in java?

572


Under what conditions is an object’s finalize() method invoked by the garbage collector?

573


What does java stand for?

547


Define inheritance?

544