Java中字符和编码比较

版权声明:@CopyRight转载请注明出处 https://blog.csdn.net/LI_AINY/article/details/87929341
  1. 上代码
	public static void main(String[] args) {
		SpringApplication.run(LearnFreemarkTestApplication.class, args);
		if('d'==100) {
			System.out.println("TRUE");
		}else {
			System.out.println("FALSE");
		}
	}
  1. 结果
    在这里插入图片描述
  2. 字符d的编码为100,所以表达式成立
    d两边的单引号不能换位双引号,否则程序出错不能运行,因为java中的字符常量必须用英文单引号包括

猜你喜欢

转载自blog.csdn.net/LI_AINY/article/details/87929341