Created
January 15, 2021 13:54
-
-
Save gyselph/311cf7bdf0bf030fac1c6fce21c9fb75 to your computer and use it in GitHub Desktop.
Java 7 to 15: new instanceof
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object obj = new String("hello"); | |
if (obj instanceof String mystr) { | |
System.out.println("String length: " + mystr.length()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment