array required, but ArrayList found

后端 未结 7 1554
执念已碎
执念已碎 2021-02-06 07:47

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         


        
7条回答
  •  伪装坚强ぢ
    2021-02-06 08:40

    Change this

    for(int i = 0; files.size() <= i; i++){
        System.out.println( i + ". Ist: " + files[i]);
    }
    

    As

    for(String i:files){
        System.out.println(i);
    }
    

    If you need index

    int index = 0;
    for(String i:files){
            System.out.println((index++) + ".Ist: " +i);
        }
    

提交回复
热议问题