方法声明无效?是否需要返回类型?


import java.util.*;
import java.awt.FlowLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JFrame;
import javax.swing.JButton;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
//----------I could just do import java.awt.*; and import java.swing.*; but, when the program get larger, this could cause glitches, so it's better not to----------
public class Gui extends JFrame{
public class QA //THIS IS WHERE I'M GETTING THE ERROR MESSAGE
{
private int x;
private JButton reg;
private JButton custon;
public Gui();
public QA()
{

我从YouTube视频(https://www.youtube.com/watch?v=6iV-v_m0z0w(中复制了代码,但我不确定问题是什么。感谢任何帮助:)

public Gui();

没有任何返回类型,也没有任何实现,它不应该在QA

将此构造函数方法向上移动到类Gui

public class Gui extends JFrame{
public Gui(){}
public class QA //THIS IS WHERE I'M GETTING THE ERROR MESSAGE
{
...
}

相关内容

最新更新