Created
January 15, 2021 13:53
-
-
Save gyselph/5c111577ffb706c65bd1c3b49bdb72cd to your computer and use it in GitHub Desktop.
Java 7 to 15: old 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) { | |
System.out.println("String length: " + ((String)obj).length()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment