correct typo in instanceof (#24332)

This commit is contained in:
Karen Tobo
2018-11-14 08:29:16 -07:00
committed by Aditya
parent 38f0a5e798
commit e64c24c23d

View File

@ -38,10 +38,10 @@ False Condition:
int y = (x == 10) ? 5 : 9; // y will equal 9 since the expression x == 10 evaluates to false int y = (x == 10) ? 5 : 9; // y will equal 9 since the expression x == 10 evaluates to false
``` ```
The instance of operator is used for type checking. It can be used to test if an object is an instance of a class, a subclass or an interface. General format- The `instanceof` operator is used for type checking. It can be used to test if an object is an instance of a class, a subclass or an interface. General format-
*object **instance** of class/subclass/interface* *object **instance** of class/subclass/interface*
Here is a program to illustrate instanecof operator: Here is a program to illustrate the `instanceof` operator:
```Java ```Java
Person obj1 = new Person(); Person obj1 = new Person();
Person obj2 = new Boy(); Person obj2 = new Boy();