Created
July 12, 2017 17:41
-
-
Save knightpop/9ef010affe746cb062bf2b8795cc7824 to your computer and use it in GitHub Desktop.
Java Variance Test
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
package org.ktz.example.blog; | |
import java.util.ArrayList; | |
import java.util.List; | |
public class Variance { | |
public static void main(String[] args) { | |
String str = ""; | |
Object obj = str; | |
List<String> listStr = new ArrayList<>(); | |
// List<Object> objects = listStr; // compile error | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment