题目
12.(单选题)public class Example1 /A{public static void main(String args[]) /B{System.out.println("ok");/CSystem.out.println("hello");system.out.println("您好");/D}A、B、C、D注释标注的哪行代码有错误?A D有错B C有错C B有错D A有错
12.(单选题)
public class Example1 //A
{
public static void main(String args[]) //B
{
System.out.println("ok");//C
System.out.println("hello");
system.out.println("您好");//D
}
A、B、C、D注释标注的哪行代码有错误?
A D有错
B C有错
C B有错
D A有错
题目解答
答案
逐行分析代码:
- A行:`public class Example1`,类定义正确,无误。
- B行:`public static void main(String args[])`,主方法签名符合Java规范,无误。
- C行:`System.out.println("ok");`,语句正确,无误。
- D行:`system.out.println("您好");`,这里`system`应为`System`,大小写不匹配导致编译错误。
综上,D行代码有误。
答案:A. D有错