answersLogoWhite

0


Best Answer

The instanceof keyword is used to determine if an object is of a particular class type.

Example:

Object obj = new String();

if(obj instanceof String) {

System.out.println("obj is a String!");

}

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: In Java what operator is used to determine if an object is of a particular class type?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering
Related questions

What is the use of new operator?

A new operater is used to allocating a memory space for a particular object.


How do you find the size of a class object?

Java does not have a sizeOf() operator and hence there is no way we can actually determine the size of a java class object. However we can analyze the overall heap space utilization to try to get an approximate indication of how much memory is used by an object but it is not accurate.


What is the particular instance of A Class?

An object


How do you invoke method by using object of the class?

If you have and object with method described within its class you can use dot access operator, for instance:myObject.DoSomething();


What happen when a java keyword new is used in an application?

When the new operator is used, a new object is created, based on the specified class.When the new operator is used, a new object is created, based on the specified class.When the new operator is used, a new object is created, based on the specified class.When the new operator is used, a new object is created, based on the specified class.


Is it possible to assign data from one object of a class to another object of a same class?

Yes. In fact this is precisely why the copy constructor and assignment operator exist.


How would you determine the longer name for the l lowercase l LDAP object class?

You can determine the longer name for the lowercase l LDAP object class by looking in the schema.


When the Java Virtual Machine sees the new operator in a program it instantiates an object for a specified class.?

Yes.


What is the declaration of the function to overload output operator inside class in c plus plus?

You can't overload the insertion operator (<<) from inside a class because the l-value must be an ostream object, but operator overloads implemented within classes always implicate the class instance itself as being the l-value. You must overload the insertion operator from outside of the class, like so: ostream& operator<<(ostream& lhs, const MyObject& rhs) { lhs << rhs.get_data(); return( lhs ); }


What is use of new operator is it necessary to be used when object of the class is crated why?

In the case of the Java language, it is necessary. The reason is because that's how creating objects was defined in Java. Note that a method can return an object, so the use of the "new" operator may be hidden: x = SomeClass.someMethod(); In this example, is someMethod() returns an object, x will point to this object; however, the "new" operator is still used in the method someMethod().


What is an object in a program?

An object in a program is a representation of data based on the class definitions. Similarly, say Car as a class, a particular car, with its own name, number plate, etc. is an object based on what contribute as a car.


What is class?

It is where you leave school or otherwise find a way to avoid going to that particular class.