Design Patterns Video Tutorial

来源:互联网 发布:淘宝虚拟商品物流 编辑:程序博客网 时间:2024/06/06 00:03

Tips

It is not allowable to call unstatic method in the static method(static main);

it is not allowable to call the private method from the different object(the public method in the same class could access to the private method);

there are no abstract fields and all methods do not have to be abstract methods; you can not create an object from abstract class

a class with only abstract methods is called interface and you can only use static and final fields.

protected fields could be inherited from subclass; no abstract descriptor should be added to methods within interface which by defaults contains abstract methos;

Integer.MAX_VALUE, folat is between -32000~320001; Integer i = 10(自动装箱);

第一种方法:s=i+""; //会产生两个String对象
第二种方法:s=String.valueOf(i); //直接使用String类的静态方法,只产生一个对象

第一种方法:i=Integer.parseInt(s);//直接使用静态方法,不会产生多余的对象,但会抛出异常
第二种方法:i=Integer.valueOf(s).intValue();//Integer.valueOf(s) 相当于 new Integer(Integer.parseInt(s)),也会抛异常,但会多产生一个对象

Design Patterns Video Tutorial 1

Design Patterns Video Tutorial 2

Object Oriented Design

Singleton Design Pattern Tutorial

原创粉丝点击