instanceof Operator

MLeo mleodaalder at gmail.com
Fri Apr 9 09:51:59 PDT 2010


Because invoking an instanceOf method on null would produce a
NullPointerException, and using the keyword would yield false.
I suppose you could do it if the MVLM interface injection works out.

Hope that helps.

On Fri, Apr 9, 2010 at 18:45, Ramesh Mandaleeka <ramesh.mandaleeka at gmail.com
> wrote:

> Thank you Jonathan. But the method you are referring is in java.lang.Class
> class not java.lang.Object. Isn't it nice to have final public boolean
> isInstanceOf(Object obj) as a method in java.lang.Object class?
>
> Note: Hope this is right forum to ask. If not please let me know I will
> cross post on the appropriate forum.
>
> Thanks,
> Ramesh
>
> On Fri, Apr 9, 2010 at 11:54 AM, Jonathan Gibbons <
> jonathan.gibbons at oracle.com> wrote:
>
> > Ramesh Mandaleeka wrote:
> >
> >> Hi,
> >>
> >> Why there is not instanceOf() method in java.lang.Object just like
> >> equals()
> >> method. Why we need an operator? A class can tell if it equals to other
> >> object or not but why not an instanceOf(Object obj) method ( I guess it
> >> should be final too).
> >>
> >> Regards,
> >> Ramesh
> >>
> >>
> >>
> > If this message was not off-topic for the list, I would reply that it's
> > there and called isAssignableFrom.
> >
> > -- Jon
> >
>
>



More information about the coin-dev mailing list