随笔分类 -  Java基础

摘要:内部类 匿名内部类也就是没有名字的内部类,匿名内部类就是重写父类或接口的方法。 正因为没有名字,所以匿名内部类只能使用一次,它通常用来简化代码编写 但使用匿名内部类还有个前提条件:必须继承一个抽象类或实体类或接口 实例1:不使用匿名内部类来实现抽象方法 1 2 3 4 5 6 7 8 9 10 11 阅读全文
posted @ 2017-11-27 20:08 LevelIsBubble 阅读(1104) 评论(0) 推荐(0)
摘要:只要equals返回true 只要compare返回0 既equals又hashCode 阅读全文
posted @ 2017-11-25 22:01 LevelIsBubble 阅读(130) 评论(0) 推荐(0)
摘要:1 /* 2 Iterator接口屏蔽了容器的底层,能够统一的遍历任何容器。 3 使用Iteartor遍历容器的步骤: 4 (1)迭代游标 Iterator it 5 (2)容器c c.iterator() 把容器元素逻辑上排成“人行树”,并返回第一个游标 6 (3)Iterator it = c.iterator(); 7 遍历和容器无关了,所有操作由迭代游标完成。 8 bo... 阅读全文
posted @ 2017-11-24 20:36 LevelIsBubble 阅读(156) 评论(0) 推荐(0)
摘要:不可变类:不可变类创建的实体,创建后,实体成员变量不再变化。如Java提供的8个包装类和String。 阅读全文
posted @ 2017-11-24 14:35 LevelIsBubble 阅读(146) 评论(0) 推荐(0)
摘要:某个类,仅当系统不存在自身类的实体才创建实体。 即,系统中要么无实体,要么仅有一个实体。 阅读全文
posted @ 2017-11-23 20:58 LevelIsBubble 阅读(119) 评论(0) 推荐(0)
摘要:1 /*输出流必须执行flush(),不然写不进去*/ 2 import java.io.*; 3 public class TestIO { 4 public static void main(String[] args) throws Exception { 5 /*单个字符的读取: int r 阅读全文
posted @ 2017-11-21 15:27 LevelIsBubble 阅读(108) 评论(0) 推荐(0)
摘要:确定流的一般过程: (1)是读还是写。读: Reader InputStream 写:Writer OutputStream (2)是否纯文本。 是: Reader Writer 否:InputStream OutputStream (3)确定流源: 硬盘:File 内存:ByteArray Cha 阅读全文
posted @ 2017-11-21 05:31 LevelIsBubble 阅读(164) 评论(0) 推荐(0)
摘要:http://www.cnblogs.com/skywang12345/p/string02.html http://www.cnblogs.com/skywang12345/p/string03.html String 和 CharSequence 关系String 继承于CharSequence 阅读全文
posted @ 2017-11-20 00:53 LevelIsBubble 阅读(170) 评论(0) 推荐(0)
摘要:初稿:2017-11-19 23:57:11 String的构造方法 1 import java.nio.charset.Charset; 2 import java.io.UnsupportedEncodingException; 3 4 public class StringContructor 阅读全文
posted @ 2017-11-19 23:44 LevelIsBubble 阅读(288) 评论(0) 推荐(0)