以下代码我遇到这样的错误我该如何解决这个问题。
:警告:可变参数方法的非可变参数调用,最后一个参数的参数类型不准确;ListView.getItems().addAll(ad); 为可变参数调用强制转换为 Object 为非可变参数调用强制转换为 Object[] 并抑制此警告
String []ad = new String[100];
String []bd = new String[100];
String []cd = new String[100];
int i=0;
try {
Class.forName(m_Driver2);
}
catch (ClassNotFoundException ex) {
ex.printStackTrace();
}
String query2 = "";
try {
//Create connection object
m_Connection2 = DriverManager.getConnection(m_Url2, "root", "");
//Create Statement object
m_Statement2 = m_Connection2.createStatement();
query2 = "SELECT * FROM diziler";
//Execute the query
m_ResultSet2 = m_Statement2.executeQuery(query2);
System.out.println("TTTTTTTTTTT");
while (m_ResultSet2.next()) {
//System.out.print(m_ResultSet.getString(1));
//cBox.getItems().addAll(m_ResultSet.getString(1));
ad[i]=m_ResultSet2.getString(1);
bd[i]=m_ResultSet2.getString(2);
//files=m_ResultSet.getString(3);
//File f4 = new File(files);
i++;
System.out.print(", ");
System.out.print(m_ResultSet2.getString(1));
System.out.print(", ");
System.out.print(m_ResultSet2.getString(2));
System.out.print("\n"); //new line
}
ListView.getItems().addAll(ad);
}
catch (SQLException ex) {
ex.printStackTrace();
System.out.println(query2);
}
finally {
try {
if (m_ResultSet2 != null)
m_ResultSet2.close();
if (m_Statement2 != null)
m_Statement2.close();
if (m_Connection2 != null)
m_Connection2.close();
}
catch (SQLException ex) {
ex.printStackTrace();
}
}