Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Interface recognition

Status
Not open for further replies.

owls

Instructor
Oct 10, 2002
23
0
0
US
Is there a way I can recognize in an if statement whether a class implements a certain interface. I basically want a certain action to occur to objects that only implement an interface I have created.
 
And what about
Code:
 instanceof
keyword?

Code:
AClass a = new AClass ();
//...
if (a instanceof MyInterface)
  //do stuff in that case

--
Globos
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top