File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes About interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "About interface " Watch "About interface " New topic

About interface

Pratik Thakare

Joined: Aug 29, 2012
Posts: 3
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

Joined: Oct 02, 2003
Posts: 11168

You can create an object/instance of a class that IMPLEMENTS the 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.

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Junilu Lacar

Joined: Feb 26, 2001
Posts: 4446

Maybe you're thinking about an anonymous class:

Junilu - [How to Ask Questions] [How to Answer Questions]
Pratik Thakare

Joined: Aug 29, 2012
Posts: 3
Thanks a Lot ....
subject: About interface
Similar Threads
Marker Interface
Interface reference with new keyword.....
interfaces and locks
is java violating interface definition.
RMI help please