Which of the following is not a syntax error?
A:Neglecting to initialize a local variable in a method before it is used.
B:Using a single equals sign instead of a double equals sign in the condition of an if statement.
C:Placing a semicolon at the end of the first line of an if statement.
D:Omitting the left and right parenthesis for the condition of an if statement.英语不好有点小看不懂
B和D选哪个呢?

解决方案 »

  1.   

    单选吗?如果单选就选D,因为B不一定都对
    B和D都不对啊
    A 方法中的局部变量被使用前忽略它的初始化 -- 这个没问题
    B 在if的条件判断中使用单个=号代替两个=号(即用=代替==) -- 这个比较暧昧,一般情况下不对,但是变量本身是boolean类型的,可以对,如bolean a; if (a=true)是可以的
    C 在if语句的第一行的末尾放置一个分号 -- 这个没问题,空的分号行不作处理
    D 省略if语句的条件判断的左右圆栝号 -- 这个不行,if的条件必须用括号括起来
      

  2.   

    C
    Which of the following is not a syntax error?//不是语法错误!!是要选对的答案!!
    A,B有可能不对,D肯定不对
    A:
    int x;
    int y = x;
    B:除了boolean类型的其他都不对