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

Describe the term diamond problem.

769


What does the string method compareto () do?

764


What is charat java?

738


Is there any sort function in java?

844


When is an object subject to garbage collection?

780


What are encapsulation, inheritance and polymorphism?

728


Is arraylist zero based?

773


What is the purpose of garbage collection in java? When is it used?

798


what are synchronized methods and synchronized statements? : Java thread

777


What is the map interface in java programming?

779


Can we write a class without main method in java?

688


What checkbox method allows you to tell if a checkbox is checked?

763


Is arraylist ordered in java?

772


what do you understand by the term string with respect to java?

775


What is an immutable object? How do you create one in java?

818