这是我的错误代码:
Exception in thread "main" :
TextAttributes cannot be resolved to a type
TextAttributes cannot be resolved to a type
Console cannot be resolved to a type
at Font.main(Font.java:8)
import java.awt.Color;
import enigma.console.*;
import enigma.core.Enigma;
public class Main
{
public static void main(String[] args)
{
TextAttributes attrs = new TextAttributes(Color.BLUE, Color.WHITE);
s_console.setTextAttributes(attrs);
System.out.println("Hello World!");
}
private static final Console s_console;
static
{
s_console = Enigma.getConsole("Hellow World!");
}
}
答案 0 :(得分:3)
不注意评论,他们错了。问题不在于您的导入,而是在您的环境中。如果在IDE中运行代码,请尝试清理环境。 我只是试图在控制台中编译和运行你的代码,它工作正常。