Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2005

Tip: Looking for answers? Try searching our database.

isa Test

Thread view: 
No One - 03 Sep 2005 07:00 GMT
I've not done Java in a couple of years and I've been doing C# during
that time, so I know I mixing my languages a bit.  What I cannot
remember how to do in Java is test an object for its type.  In C# one
uses the "isa" keyboard, but I can't find something like this in Java.
Perhaps because I am having to use 1.2?  The only thing I can think of
is to compare the objectInstance.class.getName() and
comparingObject.class.getName().  This doesn't work for inheritance very
well.  Any pointers would be greatly appreciated.
Janwillem Borleffs - 04 Sep 2005 15:12 GMT
> I've not done Java in a couple of years and I've been doing C# during
> that time, so I know I mixing my languages a bit.  What I cannot
[quoted text clipped - 4 lines]
> comparingObject.class.getName().  This doesn't work for inheritance
> very well.  Any pointers would be greatly appreciated.

Use the "instanceof" keyword.

JW
No One - 04 Sep 2005 19:00 GMT
>>I've not done Java in a couple of years and I've been doing C# during
>>that time, so I know I mixing my languages a bit.  What I cannot
[quoted text clipped - 8 lines]
>
> JW

Thanks.  I knew I was having a brain cramp.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.