JavaÖÐstaticÓ÷¨
ת×Ô
http://blog.pfan.cn/sword2008/13772.html
Ò»¡¢static
¡¡¡¡ÇëÏÈ¿´ÏÂÃæÕâ¶Î³ÌÐò£º
public class Hello{
public static void main(String[] args){
//(1)
System.out.println("Hello,world!"); //(2)
}
}
¡¡¡¡¿´¹ýÕâ¶Î³ÌÐò£¬¶ÔÓÚ´ó¶àÊýѧ¹ýJava
µÄ´ÓÀ´Ëµ£¬¶¼²»Ä°Éú¡£¼´Ê¹Ã»ÓÐѧ¹ýJava£¬¶øѧ¹ýÆäËüµÄ¸ß¼¶ÓïÑÔ£¬ÀýÈçC£¬ÄÇÄãÒ²Ó¦¸ÃÄÜ¿´¶®Õâ¶Î´úÂëµÄÒâ˼¡£ËüÖ»ÊǼòµ¥µÄÊä³ö“Hello,world”£¬Ò»µã±ðµÄÓô¦¶¼Ã»ÓУ¬È»¶ø£¬ËüȴչʾÁËstatic¹Ø¼ü×ÖµÄÖ÷ÒªÓ÷¨¡£
¡¡¡¡ÔÚ1´¦£¬ÎÒÃǶ¨ÒåÁËÒ»¸ö¾²Ì¬µÄ·½·¨ÃûΪmain£¬Õâ¾ÍÒâζןæËßJava±àÒëÆ÷£¬ÎÒÕâ¸ö·½·¨²»ÐèÒª´´½¨Ò»¸ö´ËÀàµÄ¶ÔÏó¼´¿ÉʹÓá£Ä㻹¼ÇµÃÄãÊÇÔõôÔËÐÐÕâ¸ö³ÌÐòÂð£¿Ò»°ã£¬ÎÒÃǶ¼ÊÇÔÚÃüÁîÐÐÏ£¬´òÈëÈçϵÄÃüÁ
javac Hello.java
java Hello
Hello,world!
¡¡¡¡Õâ¾ÍÊÇÄãÔËÐеĹý³Ì£¬µÚÒ»ÐÐÓÃÀ´±àÒëHello.javaÕâ¸öÎļþ£¬Ö´ÐÐÍêºó£¬Èç¹ûÄã²é¿´µ±Ç°£¬»á·¢ÏÖ¶àÁËÒ»¸öHello.classÎļþ£¬ÄǾÍÊǵÚÒ»ÐвúÉúµÄJava¶þ½øÖÆ×Ö½ÚÂë¡£µÚ¶þÐоÍÊÇÖ´ÐÐÒ»¸öJava³ÌÐòµÄ×îÆÕ±é×ö·¨¡£Ö´Ðнá¹ûÈçÄãËùÁÏ¡£ÔÚ2ÖУ¬Äã¿ÉÄÜ»áÏ룬ΪʲôҪÕâÑù²ÅÄÜÊä³ö¡£ºÃ£¬ÎÒÃÇÀ´·Ö½âÒ»ÏÂÕâÌõÓï¾ä¡££¨Èç¹ûûÓа²×°JavaÎĵµ£¬Çëµ½SunµÄ¹Ù·½ÍøÕ¾ä¯ÀÀJ2SE
API£©Ê×ÏÈ£¬SystemÊÇλÓÚjava.lang°üÖеÄÒ»¸öºËÐÄÀ࣬Èç¹ûÄã²é¿´ËüµÄ¶¨Ò壬Äã»á·¢ÏÖÓÐÕâÑùÒ»ÐУºpublic static final
PrintStream
out;½Ó×ÅÔÙ½øÒ»²½£¬µã»÷PrintStreamÕâ¸ö³¬Á´½Ó£¬ÔÚMETHODÒ³Ã棬Äã»á¿´µ½´óÁ¿¶¨ÒåµÄ·½·¨£¬²éÕÒprintln£¬»áÓÐÕâÑùÒ»ÐУº
public void println(String x)¡£
¡¡¡¡ºÃÁË£¬ÏÖÔÚÄãÓ¦¸ÃÃ÷°×ΪʲôÎÒÃÇÒªÄÇÑùµ÷ÓÃÁË£¬outÊÇSystemµÄÒ»¸ö¾²Ì¬±äÁ¿£¬ËùÒÔ¿ÉÒÔÖ±½ÓʹÓ㬶øoutËùÊôµÄÀàÓÐÒ»¸öprintln·½·¨¡£
¾²Ì¬·½·¨
¡¡¡¡Í¨³££¬ÔÚÒ»¸öÀàÖж¨ÒåÒ»¸ö·½·¨Îªstatic£¬ÄǾÍÊÇ˵£¬ÓÃÀàÃû¶øÎÞÐè±¾ÀàµÄ¶ÔÏ󼴿ɵ÷Óô˷½·¨¡£ÈçÏÂËùʾ£º
class Simple{
static void go(){
System.out.println("Go...");
}
}
public class Cal{
public
static void main(String[] args){
Simple.go();
}
}
¡¡¡¡µ÷ÓÃÒ»¸ö¾²Ì¬·½·¨¾ÍÊÇ“ÀàÃû.·½·¨Ãû”,¾²Ì¬·½·¨µÄʹÓúܼòµ¥ÈçÉÏËùʾ¡£Ò»°ãÀ´Ëµ£¬¾²Ì¬·½·¨³£³£ÎªÓ¦ÓóÌÐòÖеÄÆäËüÀ
Ïà¹ØÎĵµ£º
¾àÀëJava7µÄMR°æ±¾·¢²¼ÓжÎʱ¼äÁË£¬Í¨¹ý°²×°ÊÔÓÃÖ®ºóµÄ×ÜÌå¸Ð¾õÊÇ£ºËÙ¶ÈÓÖ¿ìÁË¡£×ÐϸÔĶÁÁËJava7µÄÏà¹ØÎĵµ·¢ÏÖ£¬Java7ÓµÓÐÈçϵÄһЩеÄÌØÐÔ¡£
Ê×ÏÈÊÇÄ£¿é»¯ÌØÐÔ£¬Èç¹ûÄú°²×°ºÍʹÓùýNetBeans6.7µÄ»°£¬ÊDz»ÊÇ»áÓÐÒ»¸öºÜ´óµÄ¸Ð¾õ£¬¾ÍÊÇNetBeans6.7µÄÆô¶¯ËٶȱÈÒÔÇ°¿ìÁ˺ܶ࣬µ±È»²¢²»ÊÇNetBeansÒѾʹ ......
1.µÃµ½µ±Ç°µÄʱ¼ä
Calendar cal = Calendar.getInstance();
String time=formatter.format(cal.getTime());
String strEnd=time.substring(0, 16);// 2007-10-30 09:30
Calendar cal = Calendar.getInstance();
String time=formatter.format(cal.getTime());
String strEnd=time.subst ......
ÔËÐÐ×Ô¼ºÅäÖõÄwebÓ¦Óã¬ÍùÍùÖ»ÄÜ¿´¼ûweblogic±àÒëÖ®ºóµÄclassÎļþ¡£¶ø¿´²»¼û±àÒëÇ°µÄjavaµÄÎļþ¡£ÎªÁ˵÷ÊÔ·½±ã£¬ÎÒÃÇÓÐʱºòÊÇÏë¿´±àÒëÇ°µÄjavaÎļþ¡£
ÔÚweblogic.xmlÖмÓÈë
<jsp-descriptor>
<jsp-param>
<param-name>keepgenerated</param-name>
<param-value>true</par ......