📄 invalidoperation.mj
字号:
/**
* This program is used to test whether your compiler can find out
* some invalid operations about array.
* The following program is wrong. Your compiler should find out the
* errors. And it's better to point out the exact posiotions of the
* errors and output useful information about the errors.
*/
class Program {
static void main() {
int[] a1 = {1,2,3,}; // ERROR: initialization expression should not end with ","
int[3] a2 = {1,2,3};
int[3] a3 = a2; // ERROR: invalid assignment
String s1 = "abc", s2=s1; // CORRECT
int l = a2.length;
l = s1.length; // ERROR
}
int[] f(int[] i) { //ERROR: method can't return an array.
return i;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -