抱歉,如果我看起来很蠢,但我是 java 新手。当我输入我一直在处理的这段代码时,出现此错误
public class Test
{
public static void main (String[] args)
{
System.out.println("This is a test");
}
{
System.out.println("also");
}
有什么想法吗?
最佳答案
像这样的基本教程可能会有很大帮助。
http://www.tutorialspoint.com/java/java_basic_syntax.htm
对于这个例子,试试这个
public class Test {
public static void main (String[] args) {
System.out.println("This is a test");
System.out.println("also");
}
}
代码应该位于某个方法内。
关于java - 插入 } 来完成 ClassBody,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8425982/