时间:2021-07-01 10:21:17 帮助过:17人阅读
public class RightShift { public static void main(String args[]) { char[] c = { 'a', 'b', 'c', 'd', 'e' }; for (int i = 0; i c.length; i) { System.out.print(c[i]); } for (int i = 0; i 2; i) { char temp = c[0]; for (int j = 0; j c.length -
public class RightShift {
public static void main(String args[]) {
char[] c = { 'a', 'b', 'c', 'd', 'e' };
for (int i = 0; i < c.length; i++) {
System.out.print(c[i]);
}
for (int i = 0; i < 2; i++) {
char temp = c[0];
for (int j = 0; j < c.length - 1; j++) {
c[j] = c[j + 1];
}
c[c.length - 1] = temp;
}
System.out.println();
for (int i = 0; i < c.length; i++) {
System.out.print(c[i]);
}
}
}