第十二周

1.

String s1 = "Helloworld";
StringBuffer sb = new StringBuffer("java");
char[] c1 = s1.toCharArray();
for (int i = c1.length - 1; i >= 0; i--) {
    System.out.print(c1[i]);
    if (c1[i] >= 97) {
        c1[i] = (char) (c1[i] - 32);
        sb.append(c1[i]);
    } else if (c1[i] <= 89) {
        c1[i] = (char) (c1[i] + 32);
        sb.append(c1[i]);
    }
}
System.out.println();
System.out.println(sb.toString());
2.
Random R = new Random();
for (int i = 0; i < 5; i++) {
    int num = 20+R.nextInt(30-20+1);
    System.out.print(num+",");
}
posted @ 2020-05-27 18:50  smile?  阅读(138)  评论(0编辑  收藏  举报