Created
December 29, 2016 22:01
-
-
Save ahirschberg/21cdd9c05249463748d698c7217291dc to your computer and use it in GitHub Desktop.
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
import java.util.Set; | |
import java.util.HashSet; | |
public class TestTypes { | |
public static void main(String[] args) { | |
Class<?> t = Set.class; | |
Object s = new HashSet<String>(); | |
Object n = new Integer(-1); | |
System.out.println(t.isInstance(s)); // true | |
System.out.println(t.isInstance(n)); // false | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment