源代码:
public class HelloWorld{
public static void main(String[] args) {
final SEX1="男"
final SEX2="女"
System.out.print(SEX1)
System.out.print(SEX2)
}
}
输出:
/85/1256/1QbR/HelloWorld.java:3: error: ';' expected
final String SEX1="?"
^
/85/1256/1QbR/HelloWorld.java:4: error: ';' expected
final String SEX2="?"
^
/85/1256/1QbR/HelloWorld.java:5: error: ';' expected
System.out.println(SEX1)
^
/85/1256/1QbR/HelloWorld.java:6: error: ';' expected
System.out.println(SEX2)
^
4 errors
你的赋值最后没有结束分号啊!!!!!!!
public class HelloWorld{
public static void main(String[] args) {
final String SEX1="男";
final String SEX2="女";
System.out.println(SEX1);
System.out.println(SEX2);
}
}
----------------------------------
public class HelloWorld{
public static void main(String[] args) {
final char SEX1='男';
final char SEX2='女';
System.out.println(SEX1);
System.out.println(SEX2);
}
}
上面两个都可以~~
public class HelloWorld{
public static void main(String[] args) {
final char SEX1='男';
final char SEX2='女';
System.out.print(SEX1);
System.out.print(SEX2);
}
}
有些是不检测代码和结果的,所以说报错也过!