我想返回一個數據庫中所有用戶的UserNames的userData ArrayList。我不斷收到錯誤,試圖返回ArrayList。誰能幫忙?如何返回一個字符串arrayList
import java.util.*;
import java.io.*;
import java.util.ArrayList;
public class readCSV
{
List<String[]> userData = new ArrayList<String[]>();
public void checkLogin() throws IOException
{
try
{
File file = new File("C:/Users/Sean/Documents/Programming assigment/Users.csv");
BufferedReader bufRdr = new BufferedReader(new FileReader(file));
String lineRead = bufRdr.readLine();
while(lineRead != null)
{
ArrayList<String> list = new ArrayList<String>();
while(lineRead != null)
{
this.userData.add (lineRead.split(","));
}
bufRdr.close();
}
}
catch(Exception er){
System.out.print(er);
System.exit(0);
}
}
public String[] getLogin()
{
return userData;
}
}
錯誤imcompatable類型
「我不斷收到錯誤」 - **總是**顯示您的問題中的錯誤。請閱讀http://tinyurl.com/so-hints –
數據庫在哪裏?我沒有看到任何JDBC。 –
public列表 getLogin() –