instance of

instanceof is a binary operator (operator) in Java and a reserved keyword in Java. Its function is to determine whether the object on the left is an instance of the class on the right, and it returns data of type boolean. Use it to determine whether an object is an instance of a Class class.

usage:

  boolean result = object instanceof class

parameter:

  result : boolean type.

  object : Required. Arbitrary object expression.

  class: Required. Any defined object class.

illustrate:

  Returns true if the object is an instance of this class. Returns false if the object is not an instance of this class, or if object is null.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325263083&siteId=291194637