Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
JTextField tfA = new JTextField(); tfA.setName("tfB");
现在,我的文本字段名称是什么? tfA还是tfB?
tfA
tfB
该变量仍将被调用tfA,但文本字段的名称将是tfB。对象既不知道也不关心你在代码中引用它们的变量是什么......
您的问题的简单答案是字段名称是 tfB. 变量将是 tfA。