File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About interface

 
Pratik Thakare
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I am just a beginner for java
I have 1 doubt
Q) I read that we can create a object of an interface . This is True but interface do not have constructors. So can any body please explane me What will be the flow . i mean how does this object is created ?
 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12022
25
Chrome Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can create an object/instance of a class that IMPLEMENTS the interface...so assuming the class Widget implements WorkerBee, you can do this:

WorkerBee myBee = new Widget();

so the object is really a Widget, but you can treat it like a WorkerBee.
 
Junilu Lacar
Bartender
Pie
Posts: 6532
21
Java Linux Mac Scala Spring
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe you're thinking about an anonymous class:

 
Pratik Thakare
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a Lot ....
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic