Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Aditi Msc   on Nov 14 In Java Category.

  
Question Answered By: Jim Williamson   on Nov 14

Yes, We cannot instantiate interface  directly
Indirectly we can create an object  of the interface.

e.g.

public interface inf {
public String get();
}

public class c implements inf{
public String get(){
return "worldofharry";
}
}

Now to create the object of interface by

inf inter = (inf)new c();

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on instance of an interface Or get search suggestion and latest updates.


Tagged: