This program is to read from a file. I would like to print out the code and not the address location. What should be added to my program?
try {
FileInputStream fileReader = new FileInputStream("Results.txt");
BufferedReader reader = new BufferedReader(new InputStreamReader(fileReader));
ArrayList<Result> myList = new ArrayList<>();
String line = reader.readLine();
String strLine;
String[] lines = line
.replace("[", "")
.replace("]", "")
.split(",");
int flag=1;
while ((strLine = reader.readLine()) != null) {
if (flag == 1) {
for (String l : lines) {
System.out.println(l.trim());
}
}
System.out.println();
System.out.println(strLine
.replace("[", "")
.replace("]", "")
.split(","));
flag++;
}
}
catch (Exception e) {
e.printStackTrace();
}
Below are the output of my program. It shows that there are 2 address location that have been printed out.I would like to print the codes not the location
< STIA1113 | Science | Credit Hours: 3 | Grade: A >
< SADN1033 | Math | Credit Hours: 3 | Grade: B+ >
< BWFF1013 | Finance | Credit Hours: 3 | Grade: A- >
[Ljava.lang.String;@45ff54e6
[Ljava.lang.String;@2328c243