Instanceof in java

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cpkrishnas
    New Member
    • Jul 2007
    • 2

    Instanceof in java

    what is mean by Isinstanceof and difference between Isinstanceof and to instanceof?
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by cpkrishnas
    what is mean by Isinstanceof and difference between Isinstanceof and to instanceof?
    instanceof is an operator that takes an arbitrary Object as the left operand
    and the name of a class as the right hand operator. If the Object is an instance
    of (sic) that particular class (or a subclass thereof) or if it is an instance of that
    particular interface (or a sub-interface thereof) the value of the expression is true,
    false otherwise.

    The Class.isInstanc e() is a method that takes an arbitrary Object as its
    single parameter. If the current Class object represents the class of the Object
    (or a sub-class, or sub-interface thereof) the method returns true, false otherwise.

    kind regards,

    Jos

    Comment

    Working...