please write java program of instanceOf keyword implementation

Answer Posted / dhanasekar

public class MainClass {
public static void main(String[] a) {

String s = null;
if (s instanceof java.lang.String) {
System.out.println("true");
} else {
System.out.println("false");
}
}

}

Is This Answer Correct ?    7 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between numeric and integer?

756


Explain with example the concept of constant variable in java.

896


Is it possible to use Semaphore/ Mutex in an Interrupt Handler?

774


What is nested interface?

762


What do you mean by local class?

770


I am a fresher and know core java, c languge, html, css etc if I am illegible for any job then send it on my email tatranakshay276@gmail.com

1387


What is the difference between JDBC 1.0 and JDBC 2.0?

2931


What is the difference between error and an exception?

792


How does thread synchronization occurs inside a monitor?

793


Give an example of use of pointers in java class.

775


Is java free for commercial?

679


Can we define a package statement after the import statement in java?

833


What is the equal sign?

823


What is java beans?

778


Can we access instance variables within static methods ?

840