Example


\begin{lstlisting}
class Main {
public static void main (String[] args) {
Stri...
...age an instance of Integer: ''+ (age instanceof Integer));
}
}
\end{lstlisting}

The output for above code will be


\begin{lstlisting}
Is name an instance of String: true
Is age an instance of Integer: true
\end{lstlisting}

In the above example, we have created an object name of the String type and another object age of the Integer type. We then used the instanceof operator to check whether the name is of the String type and age is of the Integer type.

Figure 2.7: Eclipse Welcome window in Windows
Image eclipsewelcome