此行中的多个标记在逗号和分隔符中出错

时间:2015-10-28 08:30:58

标签: java eclipse

enter image description here

请参考此图片查找错误并为我提供相应的解决方案。

1 个答案:

答案 0 :(得分:0)

您不能将System.out.println()用于任何类属性。

声明使用println()打印任何内容的任何方法和内部。

请看以下示例:

public class Test {
    static String string;
    //the following println() will create the error: Multiple markers at this line 
    //- Syntax error on token(s) bla bla bla
    System.out.println("hello");

    public void printSomething() {
        //But this is ok
        System.out.println("hello"); 
    }

    public static void main(String[] args) {
        Test test = new Test();
        test.printSomething(); // prints hello
    }
}