MCQs>IT & Programming>Core Java>Given a class containing the following pieces of code: ---------------------- public static <T> List getList() { return new ArrayList<T>(); } // ... List<?> list = new ArrayList<Integer>(); ---------------------- Adding which of the following lines would cause the class to not compile?
Core Java MCQs
Given a class containing the following pieces of code: ---------------------- public static <T> List getList() { return new ArrayList<T>(); } // ... List<?> list = new ArrayList<Integer>(); ---------------------- Adding which of the following lines would cause the class to not compile?
Answer
Correct Answer: List<Integer> list2 = list;
Explanation:
Note: This Question is unanswered, help us to find answer for this one