I have a code for my project in Java and one of the classes is as shown below but when I want to run this code I will get compile error in this class one part of code is:
package othell_Stack Overflow中文网
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.
package othell 问问题
更改以下行
public JComboBox<Object> leftAICombo; public JComboBox<Object> rightAICombo;
至
public JComboBox leftAICombo; public JComboBox rightAICombo;
此处 JComboBox<Object>仅在 java7 中引入类型参数。如果您使用低于 7 的 jdk,则会出现错误
JComboBox<Object>
Java 7中添加了泛型JComboBox。看来您使用的是早期版本的 JDK。升级到 Java 7 或删除泛型。建议使用前者,因为它提供更多功能/修复以及最新的。
JComboBox