In the code below I am getting the error in the 2nd last line of Test_1 "System.out.println(set1.get(0).get(0).txt);" in "txt" please help. java error screenshot
import java.util.ArrayList;
public class Test_1 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
ArrayList<ArrayList> set1 = new ArrayList<>();
ArrayList<abc> set2 = new ArrayList<>();
ArrayList<abc> set3 = new ArrayList<>();
set1.add(set2);
set1.add(set3);
set2.add(new abc("xxxxxx"));
set2.add(new abc("xxxxx yyyyy"));
System.out.println(set2.get(0).txt);
System.out.println(set1.get(0).get(0).txt);
System.out.println(((abc) set1.get(0).get(0)).txt);
}
}
class abc{
String txt;
public abc(String txt)
{
this.txt = txt;
}
}