What are the operands of instanceof operator?
Answers were Sorted based on User's Feedback
Answer / shaik baji
"instanceof" is a java keyword and it comes under binary
operators.
For "instanaceof" operator
the first operand is : any instance or object
the second operand is : any class name
For Ex:
-------
class Demo
{}
class InstanceofDemo
{
public static void main(String[] args)
{
Demo obj = new Demo();
if (obj instanceof Demo)
System.out.println("yes");
else
System.out.println("no");
}
}
| Is This Answer Correct ? | 1 Yes | 0 No |
How do you sort a set in java?
Can a class be declared as protected?
Can we access a database using applets?
What is meant by class and object in java?
can we add two numbers without using arthematic operators? if possible how?
What does indexof mean?
What are java methods?
What are the differences between abstract class and interface?
What is the applet security manager, and what does it provide?
Why does java not support operator overloading?
How do you add spaces in java?
Which class represents the socket that both the client and server use to communicate with each other?