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

java ·ºÐÍ

Ò»¡¢
ʹÓ÷ºÐ͵ĺô¦ÔÚÓÚ£¬ËüÔÚ±àÒëµÄʱºò½øÐÐÀàÐÍ°²È«¼ì²é£¬²¢ÇÒÔÚÔËÐÐʱËùÓеÄת»»¶¼ÊÇÇ¿ÖƵģ¬ÒþʽµÄ£¬´ó´óÌá¸ßÁË´úÂëµÄÖØÓÃÂÊ¡£
Çë¿´ÏÂÃæÕâ¸öÀý×Ó
public class Gen<T> {
 private T ob; // ¶¨Òå·ºÐͳÉÔ±±äÁ¿
 public Gen(T ob) {
  this.ob = ob;
 }
 public T getOb() {
  return ob;
 }
 public void setOb(T ob) {
  this.ob = ob;
 }
 public void showTyep() {
  System.out.println("TµÄʵ¼ÊÀàÐÍÊÇ: " + ob.getClass().getName());
 }
}
public class GenDemo {
 public static void main(String[] args) {
  // ¶¨Òå·ºÐÍÀàGenµÄÒ»¸öInteger°æ±¾
  Gen<Integer> intOb = new Gen<Integer>(88);
  intOb.showTyep();
  int i = intOb.getOb();
  System.out.println("value= " + i);
  System.out.println("----------------------------------");
  // ¶¨Òå·ºÐÍÀàGenµÄÒ»¸öString°æ±¾
  Gen<String> strOb = new Gen<String>("Hello Gen!");
  strOb.showTyep();
  String s = strOb.getOb();
  System.out.println("value= " + s);
 }
}
ÔËÐнá¹û£º
TµÄʵ¼ÊÀàÐÍÊÇ: java.lang.Integer
value= 88
----------------------------------
TµÄʵ¼ÊÀàÐÍÊÇ: java.lang.String
value= Hello Gen!
¿É¼û²ÎÊýT¿ÉÒÔ½ÓÊÜËùÓеÄÀàÐÍ£¬ÕâÀïÏ൱ÓÚobjectµÄ×÷Ó㬵«ÊÇËü¿ÉÒÔÔö¼Ó´úÂëµÄ¸´ÓÃÐÔ¡£ÒªÊDz»Ó÷ºÐ͵Ļ°£¬ÎÒÃÇÒª·Ö±ðÕë¶ÔStringºÍIntegerд2¸öÀ࣬Èç¹û²»Ð´µÄ»°£¬Ð´objectҪǿÖÆת»»£¬ÕâÑù¾Í¿ÉÄÜÅ׳öClassCastExceptionÒì³£¡£ÕâÊÇDZÔڵģ¬¶øÓ÷ºÐÍÔÚ±àÒëÆھͽøÐмì²â£¬ËùÒÔ³öÏÖÕâÖÖ¿ÉÄÜÐÔµÄÎÊÌâС¡£
¶þ¡¢
  List<String> l1 = new ArrayList<String>();
  List<Integer> l2 = new ArrayList<Integer>();
  System.out.println(l1.getClass() == l2.getClass());
ÄãÒ²Ðí»áÈÏΪÕâ¶Î´úÂëµÄÔËÐнá¹ûÊÇfalse£¬¿ÉÊÇËüÊÇtrue¡£
ÒòΪһ¸ö·ºÐÍÀàÐ͵ÄÉùÃ÷Ö»±»±àÒëÒ»´Î£¬²¢Çҵõ½Ò»¸öclassÎļþ£¬¾ÍÏñÆÕͨµÄclass»òÕßinterfaceµÄÉùÃ÷Ò»Ñù¡£´òÓ¡³öÀ´µÄ»°ËüÊÇ
class java.util.ArrayList£¬¿ÉÊǶ¼ÊÇ£º
ÀàÐͲ


Ïà¹ØÎĵµ£º

tomcatÁ¬½Ó³ØµÄÅäÖà Java¿ª·¢¼°±à³Ì˼Ïë


<Resource name="jdbc/testDB" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/testDB">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
< ......

java³£ÓÃ×é¼þÏÂÔصØÖ·

q        ¿ªÔ´Êý¾Ý¿âMySQLµÄ¹Ù·½ÍøÕ¾
http://www.mysql.com
q        JSTL±ê×¼±êÇ©¿âµÄÏÂÔØÍøÕ¾
http://java.sun.com/products/jsp/jstl
q        Struts1µÄ¹Ù·½ÍøÕ¾
http://struts.apache.org
q &n ......

JavaµÄXMLÎļþ²Ù×÷Ö®DOMÈëÃÅƪ £¨1£©

DOM³õ²½
DOMÊÇDocument Object ModelµÄËõд£¬¼´Îĵµ¶ÔÏóÄ£ÐÍ¡£Ç°Ãæ˵¹ý£¬XML½«Êý¾Ý×é֯Ϊһ¿ÅÊ÷£¬ËùÒÔDOM¾ÍÊǶÔÕâ¿ÅÊ÷µÄÒ»¸ö¶ÔÏóÃèÐð¡£Í¨Ë×µÄ˵£¬¾ÍÊÇͨ¹ý½âÎöXMLÎĵµ£¬ÎªXMLÎĵµÔÚÂß¼­ÉϽ¨Á¢Ò»¸öÊ÷Ä£ÐÍ£¬Ê÷µÄ½ÚµãÊÇÒ»¸ö¸ö¶ÔÏó¡£ÎÒÃÇͨ¹ý´æÈ¡ÕâЩ¶ÔÏó¾ÍÄܹ»´æÈ¡XMLÎĵµµÄÄÚÈÝ¡£
ÏÂÃæÎÒÃÇÀ´¿´Ò»¸ö¼òµ¥µÄÀý×Ó£¬¿´¿´ÔÚDOMÖ ......

ÎÒµÄJava×ܽá

1£® OverloadºÍOverrideµÄÇø±ð¡£OverloadedµÄ·½·¨ÊÇ·ñ¿ÉÒԸı䷵»ØÖµµÄÀàÐÍ
  ´ð£º·½·¨µÄÖØдOverridingºÍÖØÔØOverloadingÊÇJava¶à̬ÐԵIJ»Í¬±íÏÖ¡£ÖØдOverriding    ÊǸ¸ÀàÓë×ÓÀàÖ®¼ä¶à̬ÐÔµÄÒ»ÖÖ±íÏÖ£¬ÖØÔØOverloadingÊÇÒ»¸öÀàÖжà̬ÐÔµÄÒ»ÖÖ±íÏÖ¡£ Èç¹ûÔÚ×ÓÀàÖж¨Òåij·½·¨ÓëÆ丸ÀàÓÐÏàͬµÄÃû³ÆºÍ² ......

java ÕýÔò±í´ïʽ¹ýÂËhtmlÔªËØ

ÏÂÃæÊÇÒ»¸ö¹ýÂËhtmlÔªËصijÌÐò£¬Ò²Ðí¶Ô´ó¼ÒÓеã°ïÖú£¡
/**
      * filter all html element.
      * For example:<a href="www.sohu.com/test">hello!</a>
      * The filter result is :hello!
     ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ