aspose file tools
The moose likes Java in General and the fly likes initilisation of classes vs interfaces Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "initilisation of classes vs interfaces" Watch "initilisation of classes vs interfaces" New topic
Author

initilisation of classes vs interfaces

Rauhl Roy
Ranch Hand

Joined: Aug 01, 2006
Posts: 401

May I know if there is any difference between classes and interfaces initilisation?

regards,
rahul
Ådne Brunborg
Ranch Hand

Joined: Aug 05, 2005
Posts: 208
Interfaces cannot be initialized except when implemented by a class. If you have an interface MyIntf, you cannot write 'MyIntf a = new MyIntf()', but if you have a class 'MyClass implements MyIntf' you can write 'MyIntf b = new MyClass()'.

This is rather basic to Java, so I recommend Java tutorials


Entia non sunt multiplicanda praeter necessitatem
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: initilisation of classes vs interfaces
 
Similar Threads
Will every class inherit the object class?
interface extends interface ?
true or false
"Top Ten Topics that Everyone Thinks are on the SCJP Exam, but Aren't "- Bert Bates
Doubt in Interface