answersLogoWhite

0

What is mean of instanceof word in java?

Updated: 8/19/2019
User Avatar

BalasuthanthiraJayam...

Lvl 1
12y ago

Best Answer

'instanceof' is an operator that tests if the object to which this is applied is of a specific type or its descendent. You can safely typecast the object to the type tested if instanceof returns true.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is mean of instanceof word in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

In Java what operator is used to determine if an object is of a particular class type?

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!");}


Can anyone explain How can we instanceof keyword in java?

The instanceof keyword is very self explanatory: it is used to test if an object is an instance of a particular class.Example:// Make a new String objectString str = "123";// Display a message if str is a Stringif (str instanceof String) {System.out.println("str is a String!");}Of course, the above isn't very useful since we already know str is a String. So let's look at another example:public static void f(Object obj) {if (obj instanceof String) {System.out.println("obj is a String!");} else {System.out.println("obj is NOT a String!");}}In this example, we have no idea what type of object obj will be. So we test to see if obj is a String or not.The instanceof keyword was more useful in the past (before Java 1.5) when Java didn't have the idea of generic types in it. Now it's generally considered bad practice to use the instanceof keyword, since it means we don't know what type of objects we're using.


What is the use of the instanceof keyword in Java?

That is used to verify whether an object is based on the specified class (or a subclass).


What does the word java mean?

Java is an island in Indonesia, but in slang it means coffee.


Where does the word Java originate from?

java


What is subroutine in java?

Subroutine mean what (in java)?


What is native variable in java?

native is a key word used in java method. there is no variable as native in java


What does Systemout mean in java?

System.out refers to the Java console.


What do you mean by multithread program in java?

A Program in Java that spawns multiple threads is called a multithreaded program in Java.


Is java a word?

it means coffee


What does the term Java logging mean?

Java logging is data logging for the Java platform. Logging is a term in software for recording activity. Therefore Java logging is recording activity for Java.


Does java script coding mean using it for Java programs only?

Java script coding is computer coding, many things require Java, and you need to have Java enabled to view these types of programs.