javaÖеÄstaticÏê½â
Èç¹ûÒ»¸öÀà³ÉÔ±±»ÉùÃ÷Ϊstatic£¬Ëü¾ÍÄܹ»ÔÚÀàµÄÈκζÔÏó´´½¨Ö®Ç°±»·ÃÎÊ£¬¶ø²»±ØÒýÓÃÈκζÔÏó¡£static ³ÉÔ±µÄ×î³£¼ûµÄÀý×ÓÊÇmain( ) ¡£ÒòΪÔÚ³ÌÐò¿ªÊ¼Ö´ÐÐʱ±ØÐëµ÷ÓÃmain() £¬ËùÒÔËü±»ÉùÃ÷Ϊstatic¡£
ÉùÃ÷ΪstaticµÄ±äÁ¿ÊµÖÊÉϾÍÊÇÈ«¾Ö±äÁ¿¡£µ±ÉùÃ÷Ò»¸ö¶ÔÏóʱ£¬²¢²»²úÉústatic±äÁ¿µÄ¿½±´£¬¶øÊǸÃÀàËùÓеÄʵÀý±äÁ¿¹²ÓÃͬһ¸östatic±äÁ¿£¬ÀýÈ磺ÉùÃ÷Ò»¸östaticµÄ±äÁ¿count×÷ΪnewÒ»¸öÀàʵÀýµÄ¼ÆÊý¡£ÉùÃ÷ΪstaticµÄ·½·¨ÓÐÒÔϼ¸ÌõÏÞÖÆ£º
1¡¢ËüÃǽöÄܵ÷ÓÃÆäËûµÄstatic ·½·¨¡£
2¡¢ËüÃÇÖ»ÄÜ·ÃÎÊstaticÊý¾Ý¡£
3¡¢ËüÃDz»ÄÜÒÔÈκη½Ê½ÒýÓÃthis »òsuper¡£
Èç¹ûÄãÐèҪͨ¹ý¼ÆËãÀ´³õʼ»¯ÄãµÄstatic±äÁ¿£¬Äã¿ÉÒÔÉùÃ÷Ò»¸östatic¿é£¬Static ¿é½öÔÚ¸ÃÀà±»¼ÓÔØʱִÐÐÒ»´Î¡£ÏÂÃæµÄÀý×ÓÏÔʾµÄÀàÓÐÒ»¸östatic·½·¨£¬Ò»Ð©static±äÁ¿£¬ÒÔ¼°Ò»¸östatic ³õʼ»¯¿é£º
public class UserStatic {
static int a = 3;
static int b;
static void meth(int x) {
System.out.println("x = " + x);
System.out.println("a = " + a);
System.out.println("b = " + b);
}
static {
System.out.println("Static block initialized.");
b = a * 4;
}
public static void main(String args[]) {
meth(42);
} &
Ïà¹ØÎĵµ£º
Reflection ÊÇ Java ³ÌÐò¿ª·¢ÓïÑÔµÄÌØÕ÷Ö®Ò»£¬ËüÔÊÐíÔËÐÐÖÐµÄ Java ³ÌÐò¶Ô×ÔÉí½øÐмì²é£¬»òÕß˵“×ÔÉ󔣬²¢ÄÜÖ±½Ó²Ù×÷³ÌÐòµÄÄÚ²¿ÊôÐÔ¡£ÀýÈ磬ʹÓÃËüÄÜ»ñµÃ Java ÀàÖи÷³ÉÔ±µÄÃû³Æ²¢ÏÔʾ³öÀ´¡£
Java µÄÕâÒ»ÄÜÁ¦ÔÚʵ¼ÊÓ¦ÓÃÖÐÒ²ÐíÓõò»ÊǺܶ࣬µ«ÊÇÔÚÆäËüµÄ³ÌÐòÉè¼ÆÓïÑÔÖиù±¾¾Í²»´æÔÚÕâÒ»ÌØÐÔ¡£ÀýÈ磬Pasc ......
Õ⼸Ì죬ÔÚÍøÉÏËÑÁ˺ܶà¹ØÓÚjavaµÄ¶«Î÷£¬ÏÖÔÚ¸ø´ó¼Ò×ܽáһϣ¬·Ç³£ÓÐÓÃŶ£¬ºÜ¶à¶«Î÷ÎÒÃÇÔÚ¹úÄÚÊÇÎÞ·¨Á˽⵽µÄ
java³ÌÐòÔ±±ØÈ¥µÄ¹úÍâÍøÕ¾
http://www.onjava.com
ÿÖܶ¼ÓÐÐÂÎÄÕ·¢±í
http://www.developer.com/java
ÓÉGamelan.com ά»¤µÄJava¼¼ÊõÎÄÕÂÍøÕ¾
http://www.java.net
Sun¹«Ë¾Î¬»¤µÄÒ»¸öJavaÉçÇøÍøÕ¾
http:/ ......
·´ÉäÊÇJavaÓïÑÔÖкÜÖØÒªµÄÒ»¸ö×é³É²¿·Ö£¬ËùÒԾʹ˻°ÌâÌÖÂÛµÄ×ÊÔ´¿ÉνÊýÖ®²»¾¡£¬ÈÕ³£¿ª·¢Ò²»á¾³£Ê¹Óõ½¹ØÓÚ·´ÉäµÄReflection
API¡£Java5.0
Tiger³öÏÖÒԺ󣬸ü¶Ô·´ÉäAPIÓÐÁËеÄÀ©Õ¹£¬¾¡¹ÜÌÖÂ۵Ļ°ÌâºÜ¶à£¬²»¹ýÎÒ»¹ÊǾõµÃ²»¹»È«Ã棬ÓÈÆäÊǶԷºÐÍÕâÒ»¿é£¬ËùÒÔ¾ÍÎÒËùÖª£¬ÔÙ»¨Á¦Æø×ܽáÒ»·¬
Ê×ÏÈ·´ÉäµÄÈë¿ÚÊÇ´ÓClass¿ ......
package sort;
public class RadixSort {
// Çóx ÊýµÚdλÉϵÄÊý×Ö£¬ÀýÈç12345£¬Ê®Î»Êý×ÖÊÇ4 12345/10%10=4
// d=0 ±íʾ¸öλ £»d=1 ±íʾʮλ...ÒÀ´ÎÀàÍÆ
public static int digit(int d,int x){
return x/(int)Math.pow(10, d)%10;
}
public static void ra ......
Java ¶ÔÎļþ½øÐжÁд²Ù×÷µÄÀý×Ӻܶ࣬ÈóõѧÕ߸е½Ê®·ÖÀ§»ó£¬ÎÒ¾õµÃÓбØÒª½«¸÷ÖÖ·½·¨½øÐÐ
Ò»´Î·ÖÎö£¬¹éÀ࣬ÀíÇ岻ͬ·½·¨Ö®¼äµÄÒìͬµã¡£
Ò»£®ÔÚ JDK 1.0 ÖУ¬Í¨³£ÊÇÓà InputStream & OutputStream ÕâÁ½¸ö»ùÀàÀ´½øÐжÁд²Ù×÷µÄ¡£
InputStream ÖÐµÄ FileInputStream ÀàËÆÒ»¸öÎļþ¾ä±ú£¬Í¨¹ýËüÀ´¶ÔÎļþ½øÐвÙ×÷£¬ÀàËÆ ......