gpt4 book ai didi

java - 收到预期错误并且不知道为什么

转载 作者:行者123 更新时间:2023-12-02 11:09:29 31 4
gpt4 key购买 nike

我正在尝试调用void方法addToList,该方法将通过用户传递给它的两个字符串除外。我检查了dataSource类,以确保它确实接受了那些作为参数。问题是我在该方法调用上始终收到标识符>预期错误,但我不知道为什么。我已经使用数据源调用了其他方法,并且没有遇到类似的问题。

public class JListFromFile extends JFrame {

private TextField wordA;
private TextField wordB;
private JButton openButton;
private JButton newButton;
private JButton addButton;
private JButton deleteButton;
private JButton saveButton;
private TextField output;
private JList listFromFile;
private JPanel listPanel;
private JPanel textPanel;
private JPanel inputPanel;
private JPanel buttonsPanel;
private DataSource2 dataSource;
private WordPair wordPair;
public JListFromFile ()
{
// create the object to provide the data
dataSource = new DataSource2();
.
.
.
private class AddButtonListener implements ActionListener
{
public void actionPerformed (ActionEvent event)
{
listFromFile.setListData(new Object[0]);

wordA.setEnabled(true);
wordB.setEnabled(true);

String inputStringA = wordA.getText();
String inputStringB = wordB.getText();

//here is the problem
dataSource.addToList.(inputStringA, inputStringB);



}
}

最佳答案

addToList后出现点符号

dataSource.addToList.(inputStringA, inputStringB);

^_______ see the dot symbol.

关于java - 收到<Identifier>预期错误并且不知道为什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19813586/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com