public class TestChar {
/**
* @param args
* @throws UnsupportedEncodingException
*/
public static void main(String[] args) throws UnsupportedEncodingException {
// TODO Auto-generated method stub
char a = 1;
char b = '变';
char c = 34;
String s = "变";
byte[] bb = s.getBytes("gb2312");
byte[] bbb = s.getBytes("utf8");
byte[] bbbb = s.getBytes("utf16");
System.out.println(a);
System.out.println(b);
System.out.println(c);
System.out.println('"'==34);
System.out.println(bb.length);
System.out.println(bbb.length);
System.out.println(bbbb.length);
}
}
输出结果:
©
变
"
true
2
3
4