I have a ruby backround and im new to java i wrote a basic programm but somehow i get a error i cant fix! My code:
import java.util.ArrayList;
public class Musi
Hey the problem is in this method
public void returnFiles(){
for(int i = 0; files.size() <= i; i++){
System.out.println( i + ". Ist: " + files[i]);
}
}
Precisely, on the
files[i]
You are trying to access your ArrayList instance variable as if it were a an Array. Just change that for
files.get(i)
You have to use the method get(int index)
from the ArrayList<> class.