So i have defined the main class to be shown below and i have defined a words class and a sentence class. Note the program should return false when ran. However, i am getting a "Incompatible conditional operand types words and sentence" error when i run it. Isn't this how the instanceof operator is to be used or am i confused? How can my program be modified to run without crashing?
public class main{
public static void main (String[] args){
words example = new words("heyo");
sentence ex = new sentence("wats up dog");
System.out.println(example instanceof sentence);
}
}