What are the operands of instanceof operator?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What was java originally called?

709


What is Gang of four design patterns

805


what is mutual exclusion? How can you take care of mutual exclusion using java threads? : Java thread

896


Write a program in java to calculate the difference between the sum of the odd level and even level nodes of a binary tree.

753


What do you mean by object?

724


Is java developer a good career?

774


What defines function?

740


What is the difference between heap and stack memory?

888


placement papaers of spring computing technology

1196


What is a stack class in java ?

847


Can we change the scope of the overridden method in the subclass?

1070


Can we able to pass objects as an arguments in java?

776


what are the high-level thread states? : Java thread

769


From the two, which would be easier to write: synchronization code for ten threads or two threads?

819


Describe string intern() methodology

808