Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

javaʵÏÖµÄstack pop·½·¨Ð¡Ï¸½Ú

 Ç°Ð©Ìì±àС³ÌÐò£¬Ð´ÆäÖÐÓÐÒ»¸ö×Ô¼ºÊµÏÖµÄstackµÄpopÈçÏ£º
public class Stack<T>{
 
   private ArrayList<T>  list;
   public Stack(){
          list =  new ArrayList<T>();
}
          public T pop(){
              if(list.size != 0 ){
                 T popOut = list.get(list.size - 1);
                 remove(popOut);
                 return popOut;
             }
             else{
               return null;
            }
 }
}
ÎÒµ±Ê±ÔÚÁíÒ»¸öÀàÀïdebug£¬ã¶ÊÇÕÒ²»³öÀ´£¬×îºó²Å·¢ÏÖÕâÀïµÄpop·½·¨³öÎÊÌâÁË¡£µ±listÊÇintÊý¾Ýʱ£¬ÈôlistΪ1£¬2£¬3£¬2£»pop³öÀ´ÊÇ2£¬µ«ÊÇlist²¢²»ÈçÏëÏóÖеÄΪ1£¬2£¬3£»¶øÊDZä³ÉÁË1£¬3£¬2£»ÕâÊÇÒòΪdoubleµÄequals·½·¨È϶¨Ö»ÒªÖµÒ»ÑùÁ½Õß¾ÍÒ»Ñù£¬ËüpopPutΪ2£¬½Ó×Åremove(2);ËüÔÚÕÒµ½µÚÒ»¸ö2ÊǾÍÈÏΪÄÇÒѾ­Æ¥ÅäÁË£¬¾Í°ÑËüɾ³ý£¬ËùÒÔremoveÖÐÓ¦¸ÃÓÃËûµÄÖØÔغ¯Êýremove(list.size - 1).
µ±È»»¹Ó¦¸Ã×¢ÒâÈôÊÇintÐ͵ÄËûÓÅÏȽ«ÆäÈÏΪÊÇindex¶ø·ÇÊý¾Ý¡£


Ïà¹ØÎĵµ£º

¼ÆËã»ú¶þ¼¶java¸¨µ¼£ºÊÕ¼¯µÄÕýÔò±í´ïʽ

http://campus.chsi.com.cn/xy/com/200909/20090923/33536175.html 
¼ÆËã»ú¶þ¼¶java¸¨µ¼£ºÊÕ¼¯µÄÕýÔò±í´ïʽ
À´Ô´£º¿¼ÊÔ´ó     2009Äê09ÔÂ23ÈÕ 10:50
¡¡¡¡ÕýÔò±í´ïʽÊǸöºÜ²»´íµÄ¶«Î÷£¬¿ÉÒÔÈÃÄãʹÓÃÖ¸¶¨µÄģʽȥ·ÖÎö×Ö·û´®£¬µ±ÄêPerlͨ¹ýÌṩÁËÀàËÆÕýÔò±í´ïʽµÄ¹¦ÄܺóÀ´¶À²½ÎäÁÖ£¬ºÃ²»·ç¹â(²»¹ý ......

javaÖлñÈ¡Îļþ·¾¶µÄ¼¸ÖÖ·½Ê½

 ¹ØÓÚ¾ø¶Ô·¾¶ºÍÏà¶Ô·¾¶£º
¾ø¶Ô·¾¶¾ÍÊÇÄãµÄÖ÷Ò³ÉϵÄÎļþ»òĿ¼ÔÚÓ²ÅÌÉÏÕæÕýµÄ·¾¶£¬(URLºÍÎïÀí·¾¶)ÀýÈ磺C:xyz est.txt ´ú±íÁËtest.txtÎļþµÄ¾ø¶Ô·¾¶¡£http://www.sun.com/index.htmÒ²´ú±íÁËÒ»¸öURL¾ø¶Ô·¾¶¡£Ïà¶Ô·¾¶£ºÏà¶ÔÓëij¸ö»ù׼Ŀ¼µÄ·¾¶¡£°üº¬WebµÄÏà¶Ô·¾¶£¨HTMLÖеÄÏà¶ÔĿ¼£©£¬ÀýÈ磺ÔÚServletÖУ¬" ......

JavaÕýÔò±í´ïʽÈëÃÅ

ÖÚËùÖÜÖª£¬ÔÚ³ÌÐò¿ª·¢ÖУ¬ÄÑÃâ»áÓöµ½ÐèҪƥÅä¡¢²éÕÒ¡¢Ìæ»»¡¢ÅжÏ×Ö·û´®µÄÇé¿ö·¢Éú£¬¶øÕâЩÇé¿öÓÐʱÓֱȽϸ´ÔÓ£¬Èç¹ûÓô¿±àÂ뷽ʽ½â¾ö£¬ÍùÍù»áÀ˷ѳÌÐòÔ±µÄʱ¼ä¼°¾«Á¦¡£Òò´Ë£¬Ñ§Ï°¼°Ê¹ÓÃÕýÔò±í´ïʽ£¬±ã³ÉÁ˽â¾öÕâһì¶ÜµÄÖ÷ÒªÊֶΡ£
 ´ó ¼Ò¶¼ÖªµÀ£¬ÕýÔò±í´ïʽÊÇÒ»ÖÖ¿ÉÒÔÓÃÓÚģʽƥÅäºÍÌæ»»µÄ¹æ·¶£¬Ò»¸öÕýÔò±í´ïʽ¾ÍÊÇÓ ......

Java·ÃÎÊȨÏÞdzÎö

 Java·ÃÎÊȨÏÞÒ»¹²ÓÐËÄÖÖ£¬ËûÃÇÖ®¼äµÄ·ÃÎÊȨÏޱȽÏͨ¹ýÒÔÏÂÒ»×éÀý×ÓÀ´½âÊÍ
Àý×Ócode£ºModiferDemo.java
package com.glust.blog.j2se;
public class ModiferDemo{
  //ËÄÖÖ·ÃÎÊȨÏ޵ıäÁ¿£¨ÊôÐÔ£©
  private int a;
  int b;//friendly
  protected int c;
  public int d;
  ......

javaÁ¬½ÓÊý¾Ý¿â

1.javaÁ¬½ÓOracleÊý¾Ý¿â£º
 Class.forName("oracle.jdbc.driver.OracleDriver");
 String url="jdbc:oracle:thin:@127.0.0.1:1521:È«¾ÖÊý¾Ý¿âÃû";
 String uname="Óû§Ãû";
 String pwd="ÃÜÂë";
 Connection cn =DriverManager.getConnection(url,uname,pwd);
 Statement s=cn.createS ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ