aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Interface questions Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "Interface questions" Watch "Interface questions" New topic
Author

Interface questions

Parameswaran Thangavel
Ranch Hand

Joined: Mar 01, 2005
Posts: 485


when i changed the reference variable type as AnInterfaceIml ai then there is no error...
why???
vidya sagar
Ranch Hand

Joined: Mar 02, 2005
Posts: 580
Because baseclass or baseinterface reference can hold derived class object
vinuharan haran
Ranch Hand

Joined: Feb 26, 2005
Posts: 64
Hi,
If the type of the object is AnInterface,the method declaration in that interface has throws clause.Hence the compiler complains.
If the type of the object is AnInterfaceImpl, the method declaration in that class doesn't have the throws clause.so the compiler doesn't complain.
-vinu.
Parameswaran Thangavel
Ranch Hand

Joined: Mar 01, 2005
Posts: 485
hi vinu
i didn't get what u r telling..

here the methods r overridden.since the overridden methods are called based on the objcet type rather than the reference variable type. the overridding method didn't violate any contract for overridding. Then why it getting error..
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Interface questions
 
Similar Threads
Interface
Doubt
Interface
public modifier
interface problem