Last active
March 28, 2019 06:30
-
-
Save forkercat/4870c9a9205c8afcb765a9ccb9ac0ca7 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.ArrayList; | |
import java.util.List; | |
/** | |
* Main | |
*/ | |
public class Main { | |
public static void main(String[] args) { | |
Class<Number> strClz = N2umber.class; | |
Class<Integer> intClz = Integer.class; | |
List<Integer> intList = new ArrayList<>(); | |
List<? extends Number> numList = new ArrayList<>(); | |
System.out.println(intList.getClass() == numList.getClass()); | |
numList = intList; | |
} | |
} | |
/* | |
List<Integer> intList = new ArrayList<Integer>(); | |
// List<Number> numList = intList; | |
List<? extends Number> numList = intList; // error | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment