String[] courseObjects = new String[3];
File courses = new File("courses.txt");
BufferedReader in = null;
try
{
in = new BufferedReader(
new FileReader(courses));
for (int i = 0; i < courseObjects.length; i++)
{
courseObjects[i] = in.readLine();
}
in.close();
}
catch(IOException ioe)
{
System.out.println(ioe);
}
int n = -1;
String[] classCode = new String[3];
for(int i = 0; i < courseObjects.length; i++)
{
String classCode[i] = courseObjects.substring(0, 6);
}the second for loop doesn't seem to be working for me.. i know i'm probably doing something wrong.
basically, i want to get a substring from a string in the courseObjects array and put it into the classCode element.
what am i doing wrong?