利用位运算转换大小写

package Test;



public class test0 {
    public  static void main (String []args)
    {
        char a = ('A' | ' '); //转小写
        System.out.println(a);
        char b = ('b' & '_');
        System.out.println(b);//转大写
        
        //利用异或互相转换
        a = ('d' ^ ' ');
        System.out.println(a);
        b = ('D' ^ ' ');
        System.out.println(b);
    }

}

 

posted @ 2020-12-21 23:00  然终酒肆  阅读(128)  评论(0)    收藏  举报