Java基础
文章平均质量分 68
雨中蝎子
这个作者很懒,什么都没留下…
展开
-
编码
unicode的第一个版本是用两个字节(16bit)来表示所有字符 UTF-8 与UTF-16的区别 UTF-16比较好理解,就是任何字符对应的数字都用两个字节来保存.我们通常对Unicode的误解就是把Unicode与UTF-16等同了.但是很显然如果都是英文字母这做有点浪费.明明用一个字节能表示一个字符为啥整两个啊. 于是又有个UTF-8,这里的8非常容易误导人,8不是指一个字节,转载 2017-07-26 15:10:06 · 148 阅读 · 0 评论 -
Integer String 的equals == 区别
String 的 equals 和 == String a = "abc"; String b = "abc"; a.equals(b) : true; a == b : false 但是Integer有些许差异: Refer: 享元模式(FlyWeight Patten) Integer m = new Integer(202); Integer原创 2017-07-26 15:35:13 · 376 阅读 · 0 评论 -
使用枚举enum实现单例模式
单例模式的实现: 1, 普通模式: public class SingleDemo { private static SingleDemo instance; private SingleDemo() {} public SingleDemo getInstance() { if (instance == null) { instance = new SingleDem原创 2017-07-26 15:53:11 · 2401 阅读 · 1 评论 -
BigDecimal的问题
Java Doc解释 public BigDecimal(double val)Translatesa double into a BigDecimal which is the exact decimal representation of thedouble's binary floating-point value. The scale of the returned BigDe原创 2017-07-26 16:00:22 · 346 阅读 · 0 评论 -
String 字符串 文件流
String 不可变的字符串 StringBuffer 可变 (线程安全,效率稍低) StringBuilder 可变(线程不安全,常用) InputStream -- OutputStream 四大基流 ---------------------------------------- File RandomAcces原创 2017-07-26 16:11:57 · 533 阅读 · 0 评论