首页 > 其他 > 详细

ASC码和char

时间:2014-02-09 16:04:46      阅读:294      评论:0      收藏:0      [点我收藏+]
bubuko.com,布布扣
 1 package cn.sice;
 2 
 3 public class CharTest
 4 {
 5 
 6     public static void main(String[] args)
 7     {
 8         sop((char) 65633);// a
 9         sop((char) (65633 - 65536));// a
10     }
11 
12     public static void sop(Object obj)
13     {
14         System.out.println(obj);
15     }
16 
17     public static void method1()
18     {
19         // 把一个字符转换成它的ASC码
20         sop((int) ‘子‘);// 23376
21         sop((int) ‘a‘);// 97
22         // 把一个字符的ASC码转换成该字符
23         sop((char) 97);// a
24         sop((char) 23376);//25         // 打印ASC
26     }
27 
28     public static void method2()
29     {
30         for (int i = 0; i <= 65535; i++)
31         {
32             if (i % 20 == 0 && i != 0)
33             {
34                 sop("");
35             }
36             System.out.print(i + ":");
37             System.out.print((char) i);
38 
39         }
40     }
41 
42 }
bubuko.com,布布扣

ASC码和char

原文:http://www.cnblogs.com/linson0116/p/3540988.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!