I am learning Java, and I do not understand why the following code does not compile without error:
public class SecondClass{
public static void main(String[] args){
int number = 45;
if (number instanceof String) {
System.out.println("Not a String!");
}
}
}
Why do I get an error in my conditional operation? The instanceof should return true or false right? In this case there should be false since number is an int, but this code does not compile.