[BAEL-10302] - Moved articles to core-java-collections

This commit is contained in:
amit2103
2018-11-16 16:06:20 +05:30
parent 60697a321c
commit 99b8077bba
7 changed files with 14 additions and 9 deletions
@@ -1,21 +0,0 @@
package com.baeldung.classcastexception;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class ClassCastException {
public static void main(String[] args) {
String p1 = new String("John");
String p2 = new String("Snow");
String[] strArray = new String[] { p1, p2 };
ArrayList<String> strList = (ArrayList<String>) Arrays.asList(strArray);
// To fix the ClassCastException at above line, modify the code as:
// List<String> strList = Arrays.asList(strArray);
System.out.println("String list: " + strList);
}
}