Pattern matching with the logical OR operator

Report a typo

Will this code have a compilation issue?

public class TypeCheckingDemo {
    public static void main(String[] args) {
        Object obj = " ";

        if (obj instanceof String str || str.length() > 0) {
            if (str.isBlank()) {
                System.out.println("The variable contains only a whitespace");
            }
        }
    }
}
Select one option from the list
___

Create a free account to access the full topic