1
如果我有一個準備好語句的類,當用戶按下按鈕時如何調用它們。如何在另一個類中調用Java類的變量
class updateeButtonHandler implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
name = displayName.getText();
price = bookPrice.getText();
Queries update = new Queries();???????????????????
}
}
在不同類
public int update(String price, String name) throws SQLException {
ps2.setString(1, name);
ps2.setString(2, price);
System.out.print("Update - ");
return ps2.executeUpdate();
}
除了可以實例化類在construtor或通而不是在方法內部創建更多的面向對象。 –
你會怎麼做?如何顯示返回價值。謝謝 – joe
請任何意見 – joe