ºìÁªLinuxÃÅ»§
Linux°ïÖú

JAVAµÄÈëÃÅ»ù´¡Ò»Ð©¾«µä

·¢²¼Ê±¼ä:2006-11-19 00:52:00À´Ô´:ºìÁª×÷Õß:experienced
1£®°üpackage
ÔÚµÚÒ»¾äÒýÓÃpackage pkg1[.pkg2[.pkg3]];Èç¹ûÓÐÒ»¸öÀý³ÌTest.java:ËüµÄÒýÓðü£ºpackage hi;
ÏÈÔÚµ±Ç°Ä¿Â¼ÏÂÓÃjavac -d . Test.java¾Í»áÔÚµ±Ç°Ä¿Â¼Ï½¨Á¢Ä¿Â¼hi,½«Éú³ÉµÄTest.classÎļþ·Åµ½./hi/Ï¡£
»¹ÓÐÒ»ÖÖ¾ÍÊÇÖ±½ÓÊÖ¹¤½¨Á¢hi,°ÑTest.java·Åµ½./hi/Ï£¬ÓÃjavac hi/Test.java ºÍjava hi/Test¼´¿É¡£

2£®import java.io.*;
¸ù¾Ý»·¾³±äÁ¿classpathÀ´²éÕÒ°ü£¬Èç¹ûÄã×Ô¼º´´Ð´Ò»¸öjar»òÕßÊÇzipÎļþʱ£¬Ïëµ÷ÓÃËû£¬Ò»¶¨ÒªÔÚclasspathÖÐд³öÀ´¡£

3£®Èç¹ûµÃµ½form±íµ¥´«µÝµÄÖµºÍÃû³Æ
Enumeration enum = request.getParameterNames();
while(enum.hasMoreElements()){
String paraName = (String) enum.nextElement();
String paraValue = (String) request.getParameter(paraName);
}

4£®²»ÄÜÔÚÀàµÄmainºÍº¯ÊýÍâÓÃSystem.out.println£¬ÔÚ¾²Ì¬º¯ÊýÖв»ÄÜÒýÓþ²Ì¬±äÁ¿¡£

5£®ÔÚÀàÖУ¬ÓÐʵÀý±äÁ¿ºÍÀà±äÁ¿Á½ÖÖ£¬Àà±äÁ¿¾ÍÊDZ»ÀàÖеÄËùÓжÔÏó¹²Ïí¡£ÒªÓÃstatic.
·½·¨ÓÐʵÀý·½·¨£®Àà·½·¨ºÍ¹¹ÔìÆ÷·½·¨ÈýÖÖ¡£µÚÒ»ÖÖÖ»ÓÐÏÈ´´½¨¶ÔÏóÔÙµ÷ÓÃËû¡£µÚ¶þÖÖÒªÓÃstatic£¬¿ÉÒÔÖ±½Óµ÷ÓÃËû¡£

6.thisÊÇÒ»¸ö·Ç¾²Ì¬µÄ±äÁ¿£¬²»ÄÜÓëstatic²¢´æ¡£

7£®Èç¹ûÒ»¸öJAVA³ÌÐòûÓаü£¬ÔÚÒýÓõÄʱºò£¬ÒªÓÃimport ÎļþÃû¡£

8£®ÈçºÎÈ¥ÖÆÔìȱʡֵµÄ²ÎÊýÄØ£¿
eg: function(arg1,arg2)
eg: function(arg1) return function(arg1,'no');


9£®ÔÚJSP³Ìʽ»òÕßÊÇSERVLETÖУ¬Èç¹ûÏëÍ˳ö³ÌÐòÖ´ÐУ¬Ö±½Óreturn¾Í¿ÉÒÔÁË¡£

10£®Ð½¨Ò»¸öÀàµÄÁíÒ»ÖÖ·½·¨£º
Class _s = Class.forName('java.util.Date');
Date d = _s.newInstance();

11£®instanceofÊÇÅжÏÒ»¶ÔÏóµÄÒýÓÃÊÇ·ñijһÀàÐÍ¡£
eg: Interger i = new Integer(10); if(i instanceof Integer) T if(i instanceof Long) F
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 1 ÌõÆÀÂÛ

  1. ray1981 ÓÚ 2006-11-19 12:34:05·¢±í:

    good,3Q