package welcome;
import java.util.Scanner;
public class 字符的运算以及字符的转换 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in);
//字符之间的运算 以及 字符与数码的对应
char c = 'A';
char d = 'D';
System.out.println(d-c);
System.out.println((int)c);
char a = '\u0041';
char b = 65;
System.out.println(a);
System.out.println(b);
System.out.println();
//大小写转换
char m = 'D';
char n =(char)(m+'a'-'A');
System.out.println(n);
m = 'k';
n = (char)(m+'K'-'k');
System.out.println(n);
System.out.println();
//字母的大小比较
System.out.println('A'>'B');
System.out.println('a'<'汉');
}
}
字符型基础
最新推荐文章于 2024-01-24 11:25:39 发布