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

JAVA¹æ·¶Ñ§Ï°——static³ÉÔ±³õʼ»¯

class Super { static int taxi = 1729; }
class Sub extends Super {
static { System.out.print("Sub "); }
}
class Test {
public static void main(String[] args) {
System.out.println(Sub.taxi);
}
}
Êä³ö£º1729
֪ʶҪµã£º
A reference to a class field causes initialization of only the class or interface
that actually declares it, even though it might be referred to through the name of a
subclass, a subinterface, or a class that implements an interface.
Ò²¾ÍÊÇ˵ֻÓÐʹÓøÃÀà»òÕß½Ó¿ÚÖ±½Ó¶¨ÒåµÄÀà±äÁ¿£¬²Å»á¼¤·¢¸ÃÀàµÄ³õʼ»¯£»Èç¹ûʹÓõÄÊÇÆä¸¸ÀඨÒåµÄÀà±äÁ¿£¬Ôò×ÓÀ಻»á±»³õʼ»¯
interface I {
int i = 1, ii = Test.out("ii", 2);
}
interface J extends I {
int j = Test.out("j", 3), jj = Test.out("jj", 4);
}
interface K extends J {
int k = Test.out("k", 5);
}
class Test {
public static void main(String[] args) {
System.out.println(J.i);
System.out.println(K.j);
}
static int out(String s, int i) {
System.out.println(s + "=" + i);
return i;
}
}
Êä³ö£º
1
j=3
jj=4
3
 ÖªÊ¶Òªµã£º
Initialization of an interface does not, of itself, cause initialization of any of its
superinterfaces.
The reference to J.i is to a field that is a compile-time constant; therefore, it
does not cause I to be initialized. The reference to K.j is a reference to a field
actually declared in interface J that is not a compile-time constant; this causes initialization
of the fields of interface J, but not those of its superinterface I, nor
those of interface K. Despite the fact that the name K is used to refer to field j of
interface J, interface K is not initialized.


Ïà¹ØÎĵµ£º

JAVA(ËÄ)

JavaÔÓ̸£¨¾Å£©£­£­Struts 
                J2eeµÄ¿ªÔ´¿ò¼ÜºÜ¶à£¬±ÊÕßÖ»ÄܽéÉÜ×Ô¼ºÊìϤµÄ¼¸¸ö£¬ÆäËûµÄĿǰÔÚÖйúITÐÐÒµÓ¦Óõò»ÊǺܶࡣϣÍû´ó¼Ò¶ÔгöµÄ¿ò¼Ü²»ÒªÃ¤Ä¿µÄÍÆ³ç£¬Ê×ÏÈÒ»¶¨ÒªÊìϤËü±È¾ÉµÄµ½µ×ºÃÔÚÄÄÀеÄÀíÄîºÍÌØÐÔ ......

JavaÖе÷ÓÃC/C++Éú³ÉµÄDLL

JavaÖе÷ÓÃC/C++Éú³ÉµÄDLL
Ò»¡¢ Éú³ÉCµÄÍ·Îļþ
¡¡¡¡1. ±à¼­Main.java
¡¡public class Main
¡¡¡¡{
¡¡¡¡public native static int getStrNum(byte str[], int strLen);
¡¡¡¡}
¡¡¡¡2. Éú³ÉÍ·Îļþ
¡¡¡¡°´win + r´ò¿ª“ÔËÐД´°¿Ú£¬ÊäÈë“cmd”£¬´ò¿ª ......

Java½Ó¿Ú×ܽá

java½Ó¿Ú
ʲôÊǽӿÚ
¡¡¡¡JavaÖеĽӿÚÊÇһϵÁз½·¨µÄÉùÃ÷£¬ÊÇһЩ·½·¨ÌØÕ÷µÄ¼¯ºÏ£¬Ò»¸ö½Ó¿ÚÖ»Óз½·¨µÄÌØÕ÷ûÓз½·¨µÄʵÏÖ£¬Òò´ËÕâЩ·½·¨¿ÉÒÔÔÚ²»Í¬µÄµØ·½±»²»Í¬µÄÀàʵÏÖ£¬¶øÕâЩʵÏÖ¿ÉÒÔ¾ßÓв»Í¬µÄÐÐΪ(¹¦ÄÜ)¡£
¡¡¡¡½Ó¿ÚµÄÁ½ÖÖº¬Ò壺һ£¬Java½Ó¿Ú£¬JavaÓïÑÔÖдæÔڵĽṹ£¬ÓÐÌØ¶¨µÄÓï·¨ºÍ½á¹¹;¶þ£¬Ò»¸öÀàËù¾ßÓеķ½·¨µÄÌ ......

Hibernate Ö®¸¸£ºÊÇʱºòÉý¼¶µ½ Java EE 6 ÁË£¡

Hibernate
Ö®¸¸ Gavin King[1]½¨Ò鿪·¢ÕßÉý¼¶µ½ Java EE 6 ƽ̨£¬²¢Ö¸³öÁËһЩ²»Ô¸ÒâÉý¼¶µÄ¹ÛµãÆäʵÊÇûÓиù¾ÝµÄ¡£
     Java EE 6 ·¢²¼ºó£¬ÎÒ¿´µ½Á˺ܶ෴¶ÔÉý¼¶µ½ÐÂÆ½Ì¨µÄ¹Ûµã¡£ÕâЩ·´¶Ô¹Ûµã´ó¶àÊÇÓÉ Tomcat
/ Jetty ÒÔ¼°Ò»Ð©¿ªÔ´¿ò¼Ü£¨ÀýÈç Hibernate Óë Spring£©µÄʹÓÃÕßÌá³ö¡£
  
&n ......

javaºÍ¡£netÖ®¼äµÄ»¥²Ù×÷

.netÍøÕ¾theserverside.comÉÏ£¬ÓÐһƪ½².netºÍjava»¥²Ù×÷µÄÎÄÕ£¬ÊÕ¼¯ÁËnetºÍjava»¥²Ù×÷ÐÔµÄÎÄÕ¾«Ñ¡
[url]http://www.theserverside.net/tt/articles/showarticle.tss?id=InteropGuide[/url]
In the heterogeneous world of enterprise computing, interoperability is no longer a luxury but a necessity. The multip ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ