
Think in java notes
kittyjie
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Operator笔记
特别之处: 能进行&& 运算的只能是boolean型,不能是其他任何类型,否则编译时报错boolean限制非常多,不能与其他任何类型转换if(X=Y),除了X,Y是boolean型之外,编译器会报错,避免了C/C++中的问题byte,char,short在进行运算时都是提升到int进行运算的!但是有两种情况:(1)byte b;b*=222;这样编译器不会报错,会直接进行强原创 2009-07-30 15:05:00 · 579 阅读 · 0 评论 -
Enum笔记
//enum是类,里面定义的类型是枚举实例,所以可以有构造函数 public enum OzWitch {// Instances must be defined first, before methods:WEST("Miss Gulch, aka the Wicked Witch of the West"),NORTH("Glinda, the Good Witch of the No原创 2009-08-08 11:15:00 · 931 阅读 · 0 评论 -
Containers in depth笔记
public class Unsupported {static void test(String msg, List list) {System.out.println("--- " + msg + " ---");Collection c = list;Collection subList = list.subList(1,8);// Copy of the sublist:Collec原创 2009-08-07 14:14:00 · 1317 阅读 · 0 评论 -
IO笔记
FilenameFilter用法:public static void main(String[] args) { File path = new File("G://programs//java//ConsoleDatabase"); final String regex="//D*[.]?jpx//D*"; String[] list; //if (args.length ==原创 2009-08-07 21:54:00 · 1009 阅读 · 0 评论 -
Generics笔记
type argument inference public class New { public static Map map(){ return new HashMap(); } public static LinkedList lList(){ return new LinkedList(); } pub原创 2009-08-06 14:36:00 · 847 阅读 · 0 评论 -
Type Information笔记
Class.forName 会加载类 ========================================== class Initable {static final int staticFinal = 47;static final int staticFinal2 =ClassInitialization.rand.nextInt(1000);static {Sy原创 2009-08-05 12:58:00 · 846 阅读 · 0 评论 -
String笔记
public class WhitherStringBuilder {public String implicit(String[] fields) {String result = "";for(int i = 0; i result += fields[i];return result;}public String explicit(String[] fields) {StringBuilde原创 2009-08-04 16:28:00 · 547 阅读 · 0 评论 -
Initialization & Cleanup笔记
public class Flower {int petalCount = 0;String s = "initial value";Flower(int petals) {petalCount = petals;print("Constructor w/ int arg only, petalCount= "+ petalCount);}Flower(String ss) {print("Con转载 2009-07-31 10:55:00 · 682 阅读 · 0 评论 -
InnerClass笔记
interface Selector{ boolean end(); Object current(); void next();}public class Sequence { private Object[] items; private int next = 0; public Sequence(int size) { items = new Object原创 2009-08-03 15:47:00 · 1140 阅读 · 0 评论 -
Access Control
类级别的访问控制只有两种:public 或者 package,也就是说class前面只能是public或者什么都没有。要想控制类不被访问,把构造函数私有化即可原创 2009-07-31 14:17:00 · 745 阅读 · 0 评论 -
Polymorphism笔记
package poly;class Glyph { void draw() { System.out.println("Glyph.draw()"); } Glyph() { System.out.println("Glyph() before draw()"); draw(); System.out.println("G原创 2009-08-03 10:17:00 · 594 阅读 · 0 评论 -
Concurrency笔记
多线程返回值: class TaskWithResult implements Callable {private int id;public TaskWithResult(int id) {this.id = id;}public String call() { return "result of TaskWithResult " + id;}}public class Callabl原创 2009-08-11 13:25:00 · 897 阅读 · 0 评论