令牌上的语法错误"" +"",AssignmentOperator无效

时间:2017-12-06 21:38:07

标签: java

我收到标题中指定的错误消息。帮助

public class SumOfTwo {

    public static void main(String args[]) {

        int five = 5;
        int four = 4;
        int sum = five + four;

        System.out.println(five " + " four);
    }

}

1 个答案:

答案 0 :(得分:1)

要将变量值与String连接起来,它们之间需要+

更改

System.out.println(five " + " four);

System.out.println(five + " + " + four);