输入”abcdAbBCD”,分别找出大小写的的字母并打印他们的长度

package ceshi;

import java.util.ArrayList;
import java.util.List;


public class test {
	public static void main(String[] args){
		String aa = "abcdAbBCD";
        String cc = aa.toLowerCase();
        char[] bb = aa.toCharArray();
        char[] dd = cc.toCharArray();
        
        List list1 = new ArrayList();
        List list2 = new ArrayList();
        for(int i=0;i<bb.length; i++){
            if(bb[i] == dd[i]){
                list1.add(bb[i]);
                System.out.println("list1: " + bb[i]);
            }else{
                list2.add(bb[i]);
                System.out.println("list2: " + bb[i]);
            }
        }
        
        System.out.println("list1.length=" + list1.size()+ "-----"  + "list2.length="+ list2.size());


	}
}

你可能感兴趣的:(java)