File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes instance of --> chapter four operators Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "instance of --> chapter four operators" Watch "instance of --> chapter four operators" New topic
Author

instance of --> chapter four operators

timo corn
Ranch Hand

Joined: Oct 26, 2013
Posts: 68



b=Boat is a vessel, but why is b2=Boat(also is-a vessel) instance of Toy?


hth
Stuart A. Burkett
Ranch Hand

Joined: May 30, 2012
Posts: 679
timo corn wrote:why is b2=Boat(also is-a vessel) instance of Toy?

Because b2 is actually referring to a SpeedBoat (not just a Boat) and the SpeedBoat class implements the Toy interface.
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1180
use of "Instance of" in java says -

Bascially, you check if an object is an instance of a specific class. You normally use it, when you have a reference or parameter to an object that is of a super class or interface type and need to know whether the actual object has some other type (normally more concrete).


Regards,
Dan

William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
 
 
subject: instance of --> chapter four operators