Effective Java: Item 1
Static Factory Methods
Four Advantages:
1) have names
2) not required to create a new object each time they are invoked
3) return an object of any subtype of their return type
4) reduce the verbosity of creating parameterized type instances.(for example: newInstance() method)
Ïà¹ØÎĵµ£º
Javaѧϰ´ÓÈëÃŵ½¾«Í¨
Ò»¡¢ JDK (Java Development Kit)
JDKÊÇÕû¸öJavaµÄºËÐÄ£¬°üÀ¨ÁËJavaÔËÐл·¾³£¨Java Runtime Envirnment£©£¬Ò»¶ÑJava¹¤¾ßºÍJava»ù´¡µÄÀà¿â(rt.jar)¡£²»ÂÛʲôJavaÓ¦Ó÷þÎñÆ÷ʵÖʶ¼ÊÇÄÚÖÃÁËij¸ö°æ±¾µÄJDK¡£Òò´ËÕÆÎÕJDKÊÇѧºÃJavaµÄµÚÒ»²½¡£×îÖ÷Á÷µÄJ ......
create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ
......
´úÂë±àд¹æ·¶Ä¿µÄ£ºÄܹ»ÔÚ±àÂë¹ý³ÌÖÐʵÏֹ淶»¯£¬ÎªÒÔºóµÄ³ÌÐò¿ª·¢ÖÐÑø³ÉÁ¼ºÃµÄÐÐΪϰ¹ß¡£
´úÂë±àд¹æ·¶Ê¹Ó÷¶Î§£ºJ2EEÏîÄ¿¿ª·¢¡£
°üÃüÃû¹æ·¶£º
Ä¿µÄ£º°üµÄÃüÃû¹æ·¶Ó¦µ±ÌåÏÖ³öÏîÄ¿×ÊÔ´Á¼ºÃµÄ»®·Ö
servletÀàËùÔÚ°üÃüÃû¹æ·¶£º¹«Ë¾Ãû³Æ.¿ª·¢×éÃû³Æ.ÏîÄ¿Ãû³Æ.web.servlet
ÀýÈ磺net.linkcn.web.servlet
×Ô¶¨Òå± ......
class Link
{
private Node head;
public Link(Node head)
{
this.head=head;
}
public void addNode(Node node)
{
Node p=head;
while(true)
{
if(!p.hasNext())
{
p.setNext(node);
break;
}
p=p.getNext();
}
}
//²åÈë½Ú
public void insertNode(Node p,Node q)
{
q.setNext(p.getNext());
p.se ......