Skip to content

Instantly share code, notes, and snippets.

@knightpop
Created July 12, 2017 17:41
Embed
What would you like to do?
Java Variance Test
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