JAVA(Ò»)
1£® ¹ØÓÚ¶¯Ì¬¼ÓÔØ»úÖÆ??
ѧϰJava±ÈC++¸üÈÝÒ×Àí½âOOPµÄ˼Ï룬±Ï¾¹C++»¹»ìºÏÁ˲»ÉÙÃæÏò¹ý³ÌµÄ³É·Ö¡£ºÜ¶àÈ˶¼Äܱ³³öÀ´JavaÓïÑÔµÄÌص㣬ËùνµÄ¶¯Ì¬¼ÓÔØ»úÖƵȵȡ£µ±È»¸ÅÄîÍùÍùÊÇÏȼÇס¶øºóÏû»¯µÄ£¬¿ÉÓжàÉÙÈËÕæÕýÈ¥Ìå»á¹ý¶¯Ì¬¼ÓÔصĻúÖÆ£¬ÊÔͼȥѰÕÒ¹ýÆäÖеÄϸ½ÚÄØ? Ìṩ´ó¼ÒÒ»¸ö·½·¨£º
ÔÚÃüÁîÐд°¿ÚÔËÐÐJava³ÌÐòµÄʱºò£¬¼ÓÉÏÕâ¸öºÜÓÐÓõIJÎÊý£º
java ?verbose *.class
ÕâÑù»áÇåÎúµÄ´òÓ¡³ö±»¼ÓÔصÄÀàÎļþ£¬´ó²¿·ÖÊÇjdk×ÔÉíÔËÐÐÐèÒªµÄ£¬×îºó¼¸ÐлáÃ÷ÏԵĿ´µ½×Ô¼ºÓõ½µÄÄǼ¸¸öÀàÎļþ±»¼ÓÔؽøÀ´µÄ˳Ðò¡£¼´Ê¹ÄãÉùÃ÷ÁËÒ»¸öÀà¶ÔÏ󣬲»ÊµÀý»¯Ò²²»»á¼ÓÔØ£¬ËµÃ÷Ö»ÓÐÕæÕýÓõ½ÄǸöÀàµÄʵÀý¼´¶ÔÏóµÄʱºò£¬²Å»áÖ´ÐмÓÔØ¡£ÕâÑùÊDz»ÊÇ´ó¼ÒÉÔ΢ÄÜÃ÷°×Ò»µã¶¯Ì¬¼ÓÔØÁËÄØ£¿^_^
2£® ¹ØÓÚÑ°ÕÒclassÎļþÔÀí??
½¨Òé´ó¼ÒÔÚÈëÃŵÄʱºòÔÚÃüÁîÐд°¿Ú±àÒëºÍÔËÐУ¬²»Òª½èÖúJCreator»òÕßEclipseµÈIDEÈ¥°ïÖú×öÄÇЩÊÂÇé¡£³¢ÊÔ×Ô¼ºÕâÑù×ö£º
javac -classpath yourpath *.java
java -classpath yourpath *.class
Ò²ÐíºÜ¶àÈ˶¼ÄÜ¿´¶®£¬ÉèÖÃclasspathµÄÄ¿µÄ¾ÍÊǸæËß±àÒëÆ÷È¥ÄÄÀïÑ°ÕÒÄãµÄclassÎļþ. ²»¹ýÖÁÉÙ±ÊÕß½ñÈÕ²ÅŪ¶®JVMÈ¥²éѯÀàµÄÔÀí£¬±àÒëÆ÷¼ÓÔØÀàÒªÒÀ¿¿classloader£¬ ¶øclassloaderÓÐ3¸ö¼¶±ð£¬´Ó¸ßµ½µÍ·Ö±ðÊÇBootClassLoader(Ãû×Ö¿ÉÄܲ»×¼È·) , ExtClassLoader, AppClassLoader.
Õâ3¸ö¼ÓÔØÆ÷·Ö±ð¶ÔÓ¦×űàÒëÆ÷ȥѰÕÒÀàÎļþµÄÓÅÏȼ¶±ðºÍ²»Í¬µÄ·¾¶£ºBootClassLoader¶ÔÓ¦jre/classes·¾¶£¬ÊDZàÒëÆ÷×îÓÅÏÈÑ°ÕÒclassµÄµØ·½
ExtClassLoader¶ÔÓ¦jre/lib/ext·¾¶£¬ÊDZàÒëÆ÷´ÎÓÅÏÈÑ°ÕÒclassµÄµØ·½
AppClassLoader¶ÔÓ¦µ±Ç°Â·¾¶£¬ËùÒÔÒ²ÊDZàÒëÆ÷ĬÈÏÕÒclassµÄµØ·½
Æäʵ´ó¼Ò¿ÉÒÔ×Ô¼ºÐ´¸ö³ÌÐò¼òµ¥µÄ²âÊÔ£¬¶ÔÈκÎclass£¬ÀýÈçA,
µ÷ÓÃnew A().getClass().getClassLoader().toString() ´òÓ¡³öÀ´¾Í¿ÉÒÔ¿´µ½£¬°ÑclassÎļþ·ÅÔÚ²»Í¬µÄ·¾¶ÏÂÔÙ´ÎÖ´ÐУ¬¾Í»á¿´µ½Çø±ð¡£Ìرð×¢ÒâµÄÊÇÈç¹û´òÓ¡³öÀ´ÊÇnull¾Í±íʾµ½ÁË×î¸ß¼¶ BootClassLoader, ÒòΪËüÊÇC++±àдµÄ£¬²»´æÔÚJava¶ÔÓ¦µÄÀà¼ÓÔØÆ÷µÄÃû×Ö¡£
Ñ°ÕÒµÄ˳ÐòÊÇÒ»ÖÖÏòÉÏÓػصÄ˼Ï룬¼´Èç¹û±¾
Ïà¹ØÎĵµ£º
JavaÃæÏò¶ÔÏó±à³Ì-6.3 ·½·¨¸²¸Ç£¨Override£©¼ÙÈçÓÐ100¸öÀ࣬·Ö±ðΪSub1£¬Sub2…Sub100£¬ËüÃǵÄÒ»¸ö¹²Í¬ÐÐΪÊÇд×Ö£¬³ýÁËSub1ÀàÓýÅд×ÖÍ⣬ÆäÓàµÄÀ඼ÓÃÊÖд×Ö¡£¿ÉÒÔ³éÏó³öÒ»¸ö¸¸ÀàBase£¬ËüÓÐÒ»¸ö±íʾд×ֵķ½·¨write()£¬ÄÇôÕâ¸ö·½·¨µ½µ×ÈçºÎʵÏÖÄØ£¿´Ó¾¡¿ÉÄÜÌá¸ß´úÂë¿ÉÖØÓÃÐԵĽǶȿ´£¬write()·½·¨Ó¦¸Ã²ÉÓÃÊÊÓÃÓÚ´ó ......
ÏîÄ¿ÖÐÓõ½web service£¬ÓÚÊÇÑо¿Á˶þÌ죬ÏÂÃæ¸ù¾ÝÕâ¶þÌìÓõ½µÄ×ܽáһϣ¬µ±È»×î¶àµÄ»¹ÊǸù¾Ýapache cxf¹ÙÍøÎĵµhttp://cxf.apache.org ¿´Îĵµ£¬µ±È»Ò²²»ÊǶ¼¿´£¬Ö»¿´ÁË×Ô¼ºÐèÒªµÄ¡£
»ù´¡ÖªÊ¶Ñ§Ï°—— Hello Demo
Hello Demo¿ªÊ¼ÁË£¡
µÚÒ»£¬Ð½¨HelloDemo Web ÏîÄ ......
1¡¢ÖØÔØ(Overloading)
£¨1£©·½·¨ÖØÔØÊÇÈÃÀàÒÔͳһµÄ·½Ê½´¦Àí²»Í¬ÀàÐÍÊý¾ÝµÄÒ»ÖÖÊֶΡ£¶à¸öͬÃûº¯Êýͬʱ
´æÔÚ£¬¾ßÓв»Í¬µÄ²ÎÊý¸öÊý/ÀàÐÍ¡£ÖØÔØOverloadingÊÇÒ»¸öÀàÖжà̬ÐÔµÄÒ»ÖÖ±íÏÖ¡£
£¨2£©JavaµÄ·½·¨ÖØÔØ£¬¾ÍÊÇÔÚÀàÖпÉÒÔ´´½¨¶à¸ö·½·¨£¬ËüÃǾßÓÐÏàͬµÄÃû×Ö£¬µ«¾ß
Óв»Í¬µÄ²ÎÊýºÍ²»Í¬µÄ¶¨Òå¡£µ÷Ó÷½·¨Ê±Í¨¹ý´«µÝ¸øËüà ......
package CH1;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class exercise001 extends JApplet {
// ¶¨Òå±äÁ¿
private JColorChooser chooser = new JColorChooser();
private JButton button = new JButton("Show Color Chooser");
private JDialog dialo ......