´ÓC++µ½JavaµÄ×¢Òâµã£¨ÉÏ£©
1.JavaµÄ±àÒëÔËÐÐ
JavaÖеÄpackage¸ÅÄîÏ൱ÓÚC++ÖеÄnamespaceµÄ¸ÅÄî¡£µ«ÊÇjava»á°ÑpackageµÄÃû×ÖºÍÎļþϵͳÖÐĿ¼½á¹¹¶ÔÓ¦ÆðÀ´£¬Ò²¼´Èç¹ûÄãÉêÃ÷ÁËij¸öpackageµÄÃû×ÖΪcom.tij.everythingisobj£¬ÄÇôÄãµÄÎļþϵͳÖбØÐë´´½¨com\tij\everythingisobjÕâÑùÒ»¸öĿ¼½á¹¹£¬ËùÓÐÊôÓÚÕâ¸öpackageµÄjavaÔ´´úÂ붼»á·ÅÔÚÕâ¸öĿ¼Ï£¡Ö®ËùÒÔÒªÕâô×ö£¬ÊÇΪÁËjvm¼ÓÔØÔËÐÐjava´úÂë·½±ã£¬¿ÉÒÔ¸ù¾Ýpackage²¢½áºÏCLASSPATHÀ´×°ÔØ*.java±àÒëºóµÄ*.classÔÚʲôλÖá£
ÀýÈçEveryObject .java£º
package com.tij.everythingisobj;
public class EveryObject {
public static void main(String[] args) {
}
}
javac com\tij\everythingisobj\EveryObject.java
Ê×ÏÈÓÃjavacÀ´±àÒë*.javaÎļþ£¬Éú³É*.class¡£¿ÉÒÔ°ÑÕâЩ*.class´ò°ü³ÉÒ»¸öjar°ü£¬µ«±ØÐë±£ÁôÍê³ÉµÄ·¾¶Ãû³Æ¡£
java com.tij.everythingisobj.EveryObject
Éú³É*.classºó£¬¿ÉÒÔÓÃÔÚÃüÁîÐÐÖÐÓÃjavaÃüÁî¸æËßjvmҪװÔØÄĸöÀಢÔËÐУ¬´Ëʱjvm»á¸ù¾ÝCLASSPATHÖÐÉèÖõÄ·¾¶È¥ËÑË÷ÄãÒªÔËÐеÄÀà¡£Èç¹ûÄãµÄCLASSPATHΪ c:\; ./£¬ÄÇôjvm»áÔÚ c:\com/tij/everythingisobjºÍ./com/tij/everythingisobjĿ¼ÏÂËÑË÷EveryObjectÀ࣬²¢×°ÔØËüµÄ¾²Ì¬mainº¯ÊýÔËÐС£ÄãÒ²¿ÉÒÔÔÚjavaÃüÁîÖмÓÈë -cpÀ´Ö¸¶¨CLASSPATH.
java -cp ./everyobj.jar com.tij.everythingisobj.EveryObject
Èç¹ûÄãÒªÔËÐÐ*.jarÎļþ£¬ÄÇô±ØÐë°ÑÄãµÄ*.jarÎļþ°üÀ¨ÔÚ -cpÑ¡ÏîÖС£´ò¿ª*.jarÄã¿ÉÒÔ¿´µ½ÀïÃæÒ²ÊÇÍêÕûµÄ·¾¶Ãû£¬Ä¿Â¼Î÷Ã涼ÊÇ*.class¡£¸úÖ±½Ó·ÅÔÚÎļþϵͳÉÏÖ´ÐÐÊÇÀàËƵġ£
2.JavaµÄpackage
ËùÓÐ*.java¶¼ÒªÊôÓÚijһ¸öpackage£¬Ò»¸öpackage¿ÉÒÔÓµÓÐn¸ö .javaÎļþ£¬Ã¿¸ö.javaÎļþÖÐÖ»ÄÜÓÐÒ»¸öpublicµÄÀà¡£¶øÇÒÕâ¸öÀàÃû±ØÐëÓë.javaµÄÃû×ÖÒ»Ñù¡£Í¬Ò»¸öpackageµÄ *.javaÎļþ¶¼»á·ÅÔÚÎļþϵͳµÄͬһ¸öĿ¼ÏÂÃæ¡£Èç¹ûÔÚ*.javaÖÐûÓÐÖ¸¶¨package name£¬ÄÇô*.javaÊôÓÚËüËùÔÚĿ¼µÄĬÈϵÄpackage£¬Ò»°ã²»ÓÃĬÈÏpackage¡£
2.JavaµÄȨÏÞ
package accessȨÏÞ
JavaµÄȨÏÞÓÐ public, protected, package access, private¡£±È½ÏÄ°ÉúµÄÊÇpackage access£¬µ±Àà»òÕßÀà³ÉԱûÓмÓÈκÎȨÏÞÏÞ¶¨·ûʱ£¬Õâ¸öÀà»òÕßÀà³ÉÔ±µÄȨÏÞ¾ÍÊÇpackage access¡£Ò²¾ÍÊÇ˵ֻÓÐÔÚͬһ¸öpackageÖпÉÒÔ·ÃÎÊ£¬ÔÚ²»Í¬packageÖÐÊÇÎÞ·¨·ÃÎʵġ£
ÀýÈçÔ
Ïà¹ØÎĵµ£º
JavaÖеļòµ¥¹¤³§Ä£Ê½
¾ÙÁ½¸öÀý×ÓÒÔ¿ìËÙÃ÷°×JavaÖеļòµ¥¹¤³§Ä£Ê½£º
Å®æ´ÞÒÍÁÔìÈË
»°Ëµ£º“ÌìµØ¿ª±Ù£¬Î´ÓÐÈËÃñ£¬Å®æ´ÞÒÍÁΪÈË¡£”Å®æ´ÐèÒªÓÃÍÁÔì³öÒ»¸ö¸öµÄÈË£¬µ«ÔÚÅ®æ´Ôì³öÈË֮ǰ£¬È˵ĸÅÄîÖ»´æÔÚÓÚŮ洵Ä˼ÏëÀïÃæ¡£
Å®æ´ÔìÈË£¬Õâ¾ÍÊǼòµ¥¹¤³§Ä£Ê½µÄÓ¦Óá£
¡¡¡¡Ê×ÏÈ£ ......
±ÈÈçappletÎļþÊÇAppletTest.class
1£©
ÔÚAppletTest.javaµÄ´úÂëÖÐ
ʹÓÃĬÈÏ°ü£¬¼´²»ÓÃpackageÓï¾ä
ÔÚhtmlÒ³ÖеĴúÂëÊÇ
<applet code="AppletTest.class" width="400" height="300">
</applet>
AppletTest.classÎļþºÍhtmlÒ³·ÅÔÚÒ»¸öÎļþ¼ÐÖÐ
2)
ÔÚAppletTest.javaµÄ´úÂëÖÐ
package xx.yy;
ÔÚhtmlÒ³ ......
Javaѧϰ·¾¶£¨Ò»£©¹¤¾ßƪ
Ò»¡¢ JDK (Java Development Kit)
JDKÊÇÕû¸öJavaµÄºËÐÄ£¬°üÀ¨ÁËJavaÔËÐл·¾³£¨Java Runtime Envirnment£©£¬Ò»¶ÑJava¹¤¾ßºÍJava»ù´¡µÄÀà¿â(rt.jar)¡£²»ÂÛʲôJavaÓ¦Ó÷þÎñÆ÷ʵÖʶ¼ÊÇÄÚÖÃÁËij¸ö°æ±¾µÄJDK¡£Òò´ËÕÆÎÕJDKÊÇѧºÃJavaµÄµÚÒ»²½¡£×îÖ÷Á÷µÄJDKÊÇSun¹«Ë¾·¢²¼µÄJDK£¬³ýÁËSunÖ®Í⣬»¹Óкܶ๠......
ITree
package utility.structure.def;
/**
*
* @author odie.tang
*
* @version 1.0 10/30/09
*/
public interface ITree<E>{
E getData();
E remove();
void setData(E e);
int getDepth();
int getLevel();
ITree<E> getRoot();
ITree<E> get ......