Java֮staticѧϰ
¶ÔÓÚѧϰstaticÎÒÃÇÏÈÀ´¿´Á½¸öÀý×Ó£º
//Example 1 Tst.java£¬no main() method
package com.blogchina.qb2049;
public class Tst
{
static { System.out.println("111111"); }
}
ÔËÐнá¹ûΪ: 111111
Exception in thread "main" java.lang.NoSuchMethodError: main
ͬÑùµÄµÀÀí¿´µÚ¶þ¸öÀý×Ó£º
//Example 2 TFrame.java,no main() method
package com.blogchina.qb2049;
import javax.swing.JFrame;
public class TFrame
{
static {
JFrame jfr_fr= new JFrame("ÎÞmain£¨£©´°Ìå");
jfr_fr.setLocation(400,300);
jfr_fr.setSize(200,300);
jfr_fr.setVisible(true);
jfr_fr.setDefaultCloseOperation(jfr_fr.EXIT_ON_CLOSE);
}
}ÔËÐнá¹ûÈçÏÂͼ£º
Õâµ½µ×Ôõô»ØÊ£¬Õâ²»ºÍÎÒÃÇ´ó¶àÊý½Ì³Ì½éÉܵÄÎÞmain£¨£©·½·¨³ÌÐòËƺõ²»ÄÜÔËÐÐÏàì¶ÜÂð¡£Æäʵ£¬ÕâÆäÖеÄÔµÓɾÍÔÚÓÚÄǸöstaticµÄÐÞÊΡ£ÎÒ
ÔÚѧϰjavaʱ£¬staticµÄѧϰÈÃÎÒºÜÊÜÆô·¢£¬ÌØ´Ë°ÑËüµÄ×ܽáÈçÏ£¬Ï£Íû¶ÔÏëѧϰjavaµÄÅóÓÑÓÐËù°ïÖú¡£Í¬Ê±£¬±¾ÎÄÖеIJ»×㻹ϣÍû´ó¼Ò¶à¶àµÄÌá³ö
À´£¬ÎÒÃǹ²Í¬Ñ§Ï°¡£
ѧϰ±¾ÎÄÄãµ½µ×Ҫѧµ½Ê²Ã´£º
1¡¢ staticÔÚjavaÖе½µ×´ú±íʲô£¬ÎªºÎÒªÓÃËü£¿
2¡¢ staticÔÚjavaÖÐÔõôÓã¿
3¡¢ static ÓÐÄÇЩÌصãºÍʹÓõē¾ÖÏÞ”£¿
1¡¢ staticÔÚjavaÖе½µ×´ú±íʲô£¬ÎªºÎÒªÓÃËü£¿
static¨D¨D¾²Ì¬¨D¨D“Ö¸¶¨Î»ÖÓ
Ê×ÏÈ£¬ÎÒÃÇÀ´¿´¿´javaµÄÄڴ棺java°ÑÄÚ´æ·ÖΪջÄÚ´æºÍ¶ÑÄڴ棬ջÄÚ´æÓÃÀ´´æ·ÅһЩ»ù±¾ÀàÐ͵ıäÁ¿ºÍÊý×é¼°¶ÔÏóµÄÒýÓñäÁ¿£¬¶ø¶ÑÄÚ´æÖ÷ÒªÊÇÀ´·ÅÖöÔÏóµÄ¡£
ÓÃstaticµÄÐÞÊεıäÁ¿ºÍ·½·¨£¬Êµ¼ÊÉÏÊÇÖ¸¶¨ÁËÕâЩ±äÁ¿ºÍ·½·¨ÔÚÄÚ´æÖеē¹Ì¶¨Î»ÖÔ£static
storage¡£¼ÈȻҪÓГ¹Ì¶¨Î»ÖÔÄÇôËûÃǵē´óС”Ëƺõ¾ÍÊǹ̶¨µÄÁË£¬ÓÐÁ˹̶¨Î»Öú͹̶¨´óСµÄÌØÕ÷ÁË£¬ÔÚÕ»Öлò¶ÑÖпª±Ù¿Õ¼äÄǾÍÊǷdz£µÄ·½±ãÁË¡£
Èç¹û¾²Ì¬µÄ±äÁ¿»ò·½·¨ÔÚ²»³öÆä×÷ÓÃÓòµÄÇé¿öÏ£¬ÆäÒýÓþä±úÊDz»»á·¢Éú¸Ä±äµÄ¡£
ÎÒÃdz£¿´µ½£ºstatic±äÁ¿ÓеãÀàËÆÓÚCÖеÄÈ«¾Ö±äÁ¿µÄ¸ÅÄ¾²Ì¬±íʾµÄÊÇÄÚ´æµÄ¹²Ïí£¬¾ÍÊÇËüµÄÿһ¸öʵÀý¶¼Ö¸Ïòͬһ¸öÄÚ´æµØÖ·¡£°Ñ
staticÄÃÀ´£¬¾ÍÊǸæËßJVMËüÊǾ²Ì¬µÄ£¬ËüµÄÒýÓ㨺¬¼ä½ÓÒýÓ㩶¼ÊÇÖ¸Ïòͬһ¸öλÖã¬ÔÚÄǸöµØ·½£¬Äã°ÑËü¸ÄÁË£¬Ëü¾Í²»»á±ä³ÉÔÑù£¬Äã°ÑËüÇåÀíÁË£¬Ëü
¾Í²»»á»ØÀ´ÁË¡£ÎÒÃdz£¿É¿´µ½ÀàËÆÒÔϵÄÀý×ÓÀ´ËµÃ÷Õâ¸öÎÊÌ⣺
cla
Ïà¹ØÎĵµ£º
¡¶javaÓïÑÔ³ÌÐòÉè¼Æ£¨Ò»£©¡·2009Äê×Ôѧ¿¼ÊÔ´ó¸ÙµÚ1ÕÂ
www.wesiedu.com 2009-5-5 ÔÚÏßÄ£Ä⿼³¡
¶þ¡¢¿Î³ÌÄÚÈÝÓ뿼ºËÄ¿±ê
µÚ1Õ JavaÓïÑÔ»ù´¡
(Ò»)¿Î³ÌÄÚÈÝ
1.1 JavaÓïÑÔµÄÌصã
1.2 JavaÓ¦ÓóÌÐòºÍСӦÓóÌÐò
1.3 Java³ÌÐòµÄ¿ª·¢¹ý³Ì
1.4±êʶ·ûºÍ¹Ø¼ü×Ö
l.5»ù±¾Êý¾ÝÀàÐÍ
1.5.1 Âß¼ÀàÐÍ
1 ......
¡¶javaÓïÑÔ³ÌÐòÉè¼Æ£¨Ò»£©¡·2009Äê×Ôѧ¿¼ÊÔ´ó¸ÙµÚ4ÕÂ
www.wesiedu.com 2009-5-5 ÔÚÏßÄ£Ä⿼³¡
µÚ4Õ Êý×éºÍ×Ö·û´®
(Ò»)¿Î³ÌÄÚÈÝ
4.1 Êý×é
4.1.1 һάÊý×é
4.1.2 ¶àάÊý×é
4.2 ×Ö·û´®
4.2.1 ×Ö·û´®³£Á¿
4.2.2 ×Ö·û´®ÉùÃ÷ºÍ´´½¨
4.2.3 ×Ö·û´®»ù±¾²Ù×÷
4.2.4 StringTokenizerÀà
4.2.5×Ö· ......
µÚ5ÕÂͼÐνçÃæÉè¼Æ(Ò»)
(Ò»)¿Î³ÌÄÚÈÝ
5.1 ͼÐνçÃæÉè¼Æ»ù´¡
5.1.1 AWI’ºÍSwing
5.1.2×é¼þºÍÈÝÆ÷
5.1.3ʼþÇý¶¯³ÌÐòÉè¼Æ»ù´¡
5.2¿ò¼Ü´°¿Ú .
5.3±êÇ©¡¢°´Å¥ºÍ°´Å¥Ê¼þ
5.3.1 ±êÇ©
5.3.2°´Å¥ºÍ°´Å¥Ê¼þ´¦Àí
5.4Ãæ°å
5.4.1 JPanel
5.4.2 JScrollPane
5.5²¼¾ÖÉè¼Æ
5.5.1 FlowI.ayout²¼¾Ö
5.5.2 BorderI.a ......
¡¶javaÓïÑÔ³ÌÐòÉè¼Æ£¨Ò»£©¡·2009Äê×Ôѧ¿¼ÊÔ´ó¸ÙµÚ7ÕÂ
www.wesiedu.com 2009-5-5 ÔÚÏßÄ£Ä⿼³¡
µÚ7Õ ͼÐΡ¢Í¼ÏñÓë¶àýÌå
(Ò»)¿Î³ÌÄÚÈÝ
7.1 »æͼ»ù´¡
7.1.1 GraphicsÀàµÄ»ù±¾¹¦ÄÜ
7.1.2×ÖÐͺÍÑÕÉ«
7.1.3»æͼģʽ
7.2»æͼ
7.2.1 GâîphicsÀàµÄ»æͼ·½·¨
7.2.2 Gmphics2DÀàµÄ»æͼ·½·¨
7.3ͼ ......
tomcatÆô¶¯web·þÎñµÄʱºò×ÜÊÇ»áÓÐ8СʱµÄʱ²î,
×ÁÄ¥Á˺þÃ,×î¼òµ¥µÄ°ì·¨¾ÍÊÇ
ÕÒµ½Îļþ¼Ðjdk1.6.0_07\jre\lib\zi\Etc
ÕâÀï±ß¶¼ÊÇһЩʱÇøÎļþGTM+1,GTM+2,GTM+3....
±¸·ÝÒ»·ÝEtc
¿½±´N·ÝGTM+8Îļþ(ÖйúµÄʱÇøÊÇGTM+8)
°ÑGMT+8ÎļþÃû¸Ä³ÉGTM+1,GTM+2,GTM+3....
¸²¸ÇµôÔÀ´µÄEtcÀï±ßµÄÎļþ
ÖØÆôtomcatÎÊÌâ½â¾ö ......