filmov
tv
Java Interview Questions and Answers What is the use of 'instanceof' keyword in java

Показать описание
Java Interview Questions and Answers - What is the use of 'instanceof' keyword in java ?
What is the use of 'instanceof' keyword in java ?
The instanceof keyword can be used to test if an object is of a specified type.
//What is the use of instanceof keyword ?
String str = "interviewdot";
Integer intval = new Integer(100);
Boolean bool = new Boolean(true);
if(str instanceof String){
}
if(intval instanceof Integer){
}
if(bool instanceof Boolean){
}