62,614
社区成员
发帖
与我相关
我的任务
分享
public class Test {
private String str;//类里面定义变量
public void method(){
System.out.println(str);
}
}
public class GuessNumberGame {
public static void main(String[] args) {
int[] arr = { 44, 33, 55, 11, 22};
String s1 = ar(arr);
System.out.println(s1);
}
public static String ar(int[] arr) {
String s = "[";
for (int i = 0; i < arr.length; i++) {
if (i == arr.length - 1) {
s += arr[i] + "]";
} else {
s += arr[i] + "X";
}
}
return s;
}
}