Java 对象创建错误

发布于 2024-08-30 06:11:23 字数 293 浏览 3 评论 0原文

package Sartre.Connect4;

import javax.swing.*;


public class ChatGUI extends JDialog {

public ChatGUI(){

    setTitle("Chat");

}

我在同一个包中的另一个类中执行此操作时:

ChatGUI chatGUI = new ChatGUI();

我最终遇到一种情况:找不到符号

请帮忙?

package Sartre.Connect4;

import javax.swing.*;


public class ChatGUI extends JDialog {

public ChatGUI(){

    setTitle("Chat");

}

}

when i do this in another class in the same package:

ChatGUI chatGUI = new ChatGUI();

i end up with a situation: Cannot Find Symbol

please help?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

幻梦 2024-09-06 06:11:23

“找不到符号”意味着编译器找不到代码中正在使用的类、方法或字段(它还会准确地告诉您是哪一个)。这意味着以下两件事之一:

  • 类/方法/字段名称输入错误
  • 编译器无法在其类路径中找到它

"Cannot Find Symbol" means that the compiler cannot find a class, method or field that's being used in your code (it wil also tell you exactly which one). This means one of two things:

  • The class/method/field name is mistyped
  • The compiler cannot find it in its classpath
云醉月微眠 2024-09-06 06:11:23

两个文件都在目录中吗

<project root>/Sartre/Connect4 ?

如果结构是,可能会弄乱

<project root>/Sarte.Connect4

Are both files in the directory

<project root>/Sartre/Connect4 ?

It might mess things up if the structure is

<project root>/Sarte.Connect4
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文