第十二周作业

package Wxte;

public class Best {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		   String str = "Hello World";
	        char[] c = str.toCharArray();
	        StringBuffer buffer = new StringBuffer();

	        for (int b= str.length() - 1; b >= 0; b--) {
	            if ((c[b] >= 'A') && (c[b] <= 'Z')) {
	                buffer.append(String.valueOf(c[b]).toLowerCase());
	         } else if ((c[b] >= 'a') && (c[b] <= 'z')) {
	                buffer.append(String.valueOf(c[b]).toUpperCase());
	        }
	        }
	        System.out.println(buffer.toString());
}
}

  

package Wxte;
import java.util.Random;
public class Demmom {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
	     Random rand = new Random();
	        int[] num = new int[5];
	        for (int a=0; a<num.length; a++) {
	             num[a] = 20 + rand.nextInt(31);
	             System.out.println(num[a]);
	}
    }
	}
	

  

posted @ 2020-05-27 08:08  Demens  阅读(93)  评论(0编辑  收藏  举报