1. Õ»(stack)Óë¶Ñ(heap)¶¼ÊÇJavaÓÃÀ´ÔÚRamÖдæ·ÅÊý¾ÝµÄµØ·½¡£ÓëC++²»Í¬£¬Java×Ô¶¯¹ÜÀíÕ»ºÍ¶Ñ£¬³ÌÐòÔ±²»ÄÜÖ±½ÓµØÉèÖÃÕ»»ò¶Ñ¡£ 2. Õ»µÄÓÅÊÆÊÇ£¬´æÈ¡ËٶȱȶÑÒª¿ì£¬½ö´ÎÓÚÖ±½ÓλÓÚCPUÖеļĴæÆ÷¡£µ«È±µãÊÇ£¬´æÔÚÕ»ÖеÄÊý¾Ý´óСÓëÉú´æÆÚ±ØÐëÊÇÈ·¶¨µÄ£¬È±·¦Áé»îÐÔ¡£ÁíÍ⣬ջÊý¾Ý¿ÉÒÔ¹²Ïí£¬Ïê¼ûµÚ3µã¡£¶ÑµÄÓÅÊÆÊÇ¿ÉÒÔ¶¯Ì¬µØ·ÖÅäÄÚ´æ´óС£¬Éú´æÆÚÒ²²»±ØÊÂÏȸæËß±àÒëÆ÷£¬JavaµÄÀ¬»øÊÕ¼¯Æ÷»á×Ô¶¯ÊÕ×ßÕâЩ²»ÔÙʹÓõÄÊý¾Ý¡£µ«È±µãÊÇ£¬ÓÉÓÚÒªÔÚÔËÐÐʱ¶¯Ì¬·ÖÅäÄڴ棬´æÈ¡ËٶȽÏÂý¡£
3. JavaÖеÄÊý¾ÝÀàÐÍÓÐÁ½ÖÖ¡£ Ò»ÖÖÊÇ»ù±¾ÀàÐÍ(primitive types), ¹²ÓÐ8ÖÖ£¬¼´int, short, long, byte, float, double, boolean, char(×¢Ò⣬²¢Ã»ÓÐstringµÄ»ù±¾ÀàÐÍ)¡£ÕâÖÖÀàÐ͵Ķ¨ÒåÊÇͨ¹ýÖîÈçint a = 3; long b = 255L;µÄÐÎʽÀ´¶¨ÒåµÄ£¬³ÆΪ×Ô¶¯±äÁ¿¡£ÖµµÃ×¢ÒâµÄÊÇ£¬×Ô¶¯±äÁ¿´æµÄÊÇ×ÖÃæÖµ£¬²»ÊÇÀàµÄʵÀý£¬¼´²»ÊÇÀàµÄÒýÓã¬ÕâÀﲢûÓÐÀàµÄ´æÔÚ¡£Èçint a = 3; ÕâÀïµÄaÊÇÒ»¸öÖ¸ÏòintÀàÐ͵ÄÒýÓã¬Ö¸Ïò3Õâ¸ö×ÖÃæÖµ¡£ÕâЩ×ÖÃæÖµµÄÊý¾Ý£¬ÓÉÓÚ´óС¿ÉÖª£¬Éú´æÆÚ¿ÉÖª(ÕâЩ×ÖÃæÖµ¹Ì¶¨¶¨ÒåÔÚij¸ö³ÌÐò¿éÀïÃ棬³ÌÐò¿éÍ˳öºó£¬×Ö¶ÎÖµ¾ÍÏûʧÁË)£¬³öÓÚ×·ÇóËٶȵÄÔÒò£¬¾Í´æÔÚÓÚÕ»ÖС£ ÁíÍ⣬ջÓÐÒ»¸öºÜÖØÒªµÄÌØÊâÐÔ£¬¾ÍÊÇ´ ......
1¡¢ÃæÏò¶ÔÏóµÄÌØÕ÷ÓÐÄÄЩ·½Ãæ
1.³éÏó£º
³éÏó¾ÍÊǺöÂÔÒ»¸öÖ÷ÌâÖÐÓ뵱ǰĿ±êÎ޹صÄÄÇЩ·½Ã棬ÒÔ±ã¸ü³ä·ÖµØ×¢ÒâÓ뵱ǰĿ±êÓйصķ½Ãæ¡£³éÏó²¢²»´òËãÁ˽âÈ«²¿ÎÊÌ⣬¶øÖ»ÊÇÑ¡ÔñÆäÖеÄÒ»²¿·Ö£¬ÔÝʱ²»Óò¿·Öϸ½Ú¡£³éÏó°üÀ¨Á½¸ö·½Ã棬һÊǹý³Ì³éÏ󣬶þÊÇÊý¾Ý³éÏó¡£
2.¼Ì³Ð£º
¼Ì³ÐÊÇÒ»ÖÖÁª½áÀàµÄ²ã´ÎÄ£ÐÍ£¬²¢ÇÒÔÊÐíºÍ¹ÄÀøÀàµÄÖØÓã¬ËüÌṩÁËÒ»ÖÖÃ÷È·±íÊö¹²ÐԵķ½·¨¡£¶ÔÏóµÄÒ»¸öÐÂÀà¿ÉÒÔ´ÓÏÖÓеÄÀàÖÐÅÉÉú£¬Õâ¸ö¹ý³Ì³ÆΪÀà¼Ì³Ð¡£ÐÂÀà¼Ì³ÐÁËÔʼÀàµÄÌØÐÔ£¬ÐÂÀà³ÆΪÔʼÀàµÄÅÉÉúÀࣨ×ÓÀࣩ£¬¶øÔʼÀà³ÆΪÐÂÀàµÄ»ùÀࣨ¸¸Àࣩ¡£ÅÉÉúÀà¿ÉÒÔ´ÓËüµÄ»ùÀàÄÇÀï¼Ì³Ð·½·¨ºÍʵÀý±äÁ¿£¬²¢ÇÒÀà¿ÉÒÔÐ޸ĻòÔö¼Óеķ½·¨Ê¹Ö®¸üÊʺÏÌØÊâµÄÐèÒª¡£
3.·â×°£º
·â×°Êǰѹý³ÌºÍÊý¾Ý°üΧÆðÀ´£¬¶ÔÊý¾ÝµÄ·ÃÎÊÖ»ÄÜͨ¹ýÒѶ¨ÒåµÄ½çÃæ¡£ÃæÏò¶ÔÏó¼ÆËãʼÓÚÕâ¸ö»ù±¾¸ÅÄ¼´ÏÖʵÊÀ½ç¿ÉÒÔ±»Ãè»æ³ÉһϵÁÐÍêÈ«×ÔÖΡ¢·â×°µÄ¶ÔÏó£¬ÕâЩ¶ÔÏóͨ¹ýÒ»¸öÊܱ£»¤µÄ½Ó¿Ú·ÃÎÊÆäËû¶ÔÏó¡£
4. ¶à̬ÐÔ£º
¶à̬ÐÔÊÇÖ¸ÔÊÐí²»Í¬ÀàµÄ¶ÔÏó¶ÔͬһÏûÏ¢×÷³öÏìÓ¦¡£¶à̬ÐÔ°üÀ¨²ÎÊý»¯¶à̬ÐԺͰüº¬¶à̬ÐÔ¡£¶à̬ÐÔÓïÑÔ¾ßÓÐÁé»î¡¢³éÏó¡¢ÐÐΪ¹²Ïí¡¢´úÂë¹²ÏíµÄÓÅÊÆ£¬ºÜºÃµÄ½â¾öÁËÓ¦ÓóÌÐòº¯ÊýͬÃûÎÊÌâ¡£
2¡¢StringÊÇ×î»ù±¾µÄ ......
MineHeÔ´´
¿´ÁËһ϶ÔJava GUIÌÖÂÛµÄÌû×Ó£¬ËùÒÔдÁËһƪÎÄÕÂÀ´²ûÊöһϸ÷ÖÖGUI¼¼ÊõµÄÓÅÁÓ¡£
JavaÊÀ½çÖУ¬Ä¿Ç°×îÖªÃûµÄÈý´óGUI¿â·Ö±ðÊÇ£º
1¡¢AWT£¨Abstract Window Toolkit£©³éÏó´°¿Ú¹¤¾ß°ü¿â£¬°üº¬ÓÚËùÓеÄJava SDKÖÐ
2¡¢Swing¸ß¼¶Í¼Ðο⣬°üº¬ÓÚJava2 SDKÖÐ
3¡¢À´×ÔIBM Eclipse¿ªÔ´ÏîÄ¿µÄSWT£¨Standard Widget Toolkit£©±ê×¼´°¿Ú²¿¼þ¿â£¬²»°üº¬ÓÚJDKÖУ¬ÐèÒª´ÓEclipseµ¥¶ÀÏÂÔØ
Ò»¡¢AWTµÄÔÀí£ºÐ¡ÇÉÈ´¼òªµÄGUIϵͳ
AWT³öÏÖÓÚJava 1.xÖУ¬ÊÇJava³õÆÚËùÄÚÖõÄÒ»ÖÖÃæÏò´°¿ÚÓ¦ÓõĿ⡣AWTʹÓõļ¼ÊõÊǶԵÈÉè¼Æģʽ£¨¼´Peer£©£¬Æä½á¹¹¹Øϵ²Î¼ûÏÂͼ¡£
´ÓÕâ·ùÀà¹ØϵͼºÜÈÝÒ׿´³öAWTµÄ¼¼ÊõʵÏÖºÍPeerÉè¼Æģʽ¡£Í¼ÖУ¬»ÆÉ«µÄÀàÊÇjava.awt°üÖеÄÀ࣬dz»ÒÉ«²¿·ÖÊÇJavaÐéÄâ»ú²¿·Ö£¬¶øÉî»ÒÉ«ÔòÊÇWindowsƽ̨¡£
awtµÄÖصãÊǶԵÈPeerÉè¼Æģʽ¡£ËùνPeer¶ÔµÈÉè¼Æģʽ¾ÍÊǽ«awt¿Ø¼þÖ±½Ó¶ÔÓ¦µ½ÔËÐÐƽ̨ÉϵÄÒ»¸öÀàËÆ»òÕßµÈͬ¿Ø¼þÉÏ¡£±ÈÈçͼÖеÄButtonÀà¾ÍÊǶÔÓ¦ÁËÉî»ÒÉ«µÄWindowsµÄ±ê×¼Button¹¦ÄÜ¡£
¶ÔµÈģʽÓÃÓÚÔÚÁ½¸ö¿Ø¼þ¼äÖ®¼ä½¨Á¢Ò»¸öÏ໥×÷ÓõÄÁªÏµ£¬¶ø³äµ±Å¦´øµÄÔòÊÇJavaÐéÄâ»úºÍÐéÄâ»ú£GDIµÄ½Ó¿Ú£¨ÒÔWindowsΪÀý×Ó£©¡£ËùÒÔ£¬ÎÒÃÇ¿ÉÒÔ¿´³ö£¬awtÊ×ÏÈÐèÒª¾¹ýͨÓõÄJava¼¼ÊõÀ´¿Ø ......
//Îå¸öÀà
--|fileÀֱࣺ½ÓÓëÎļþ±¾ÉíÓйØϵ
--|×Ö½ÚÁ÷ OutputStream InputStream
--|×Ö·ûÁ÷ Writer Reader
´æ·ÅÔÚÎļþÖеĶ¼ÊÇ×Ö½Ú¡£¶ø¶Áµ½ÄÚ´æÖвſÉÄܱä³É×Ö·û
´òÓ¡Á÷£ºprintStream/PrintWriter:ÌṩÁ˸÷ÖÖ´òÓ¡¹¦ÄÜ£¬¿ÉÒÔÊä³öÈÎÒâµÄÄÚÈÝ£¬¸ù¾ÝʵÀý»¯¶ÔÏóµÄ²»Í¬
Êä³öµÄλÖÃÒ²²»Í¬
package java11.IO;
import java.io.*;
public class FileTest
{
public static void main(String args[]){
makeDir("D:\\ACM");
}
//ÔËÓõݹé²Ù×÷´òÓ¡ËùÓеÄĿ¼
public static void makeDir(String dir){
try{
File f = new File(dir);
String str[] = null;
if(f.isDirectory()){
str = f.list();
for(int i =0;i<str.length ; i++){
//separatorChar=="\\"
//makeDir(dir+"\\"+str[i]);
makeDir(dir+f.separatorChar+str[i]);
}
}else{
System.out.println(dir);
}
}catch(Exception e){
}
}
}
package java11.IO;
import java.io.*;
public class OutputStreamTest
{
//OutputStream||InputStream¶¼ÊDzÙ×÷×Ö½ÚҪͨ¹ýbyte½øÐÐת»»
//Èç¹ûÍü¼Ç ......
/**
* µÃµ½±¾ÖÜÖÜÒ»
*
* @return yyyy-MM-dd
*/
public static String getMondayOfThisWeek() {
Calendar c = Calendar.getInstance();
int day_of_week = c.get(Calendar.DAY_OF_WEEK) - 1;
if (day_of_week == 0)
day_of_week = 7;
c.add(Calendar.DATE, -day_of_week + 1);
return df2.format(c.getTime());
}
/**
* µÃµ½±¾ÖÜÖÜÈÕ
*
* @return yyyy-MM-dd
*/
public static String getSundayOfThisWeek() {
Calendar c = Calendar.getInstance();
int day_of_week = c.get(Calendar.DAY_OF_WEEK) - 1;
if (day_of_week == 0)
day_of_week = 7;
c.add(Calendar.DATE, -day_of_week + 7);
return df2.format(c.getTime());
} ......
Properties props=System.getProperties(); //ϵͳÊôÐÔ
System.out.println("JavaµÄÔËÐл·¾³°æ±¾£º"+props.getProperty("java.version"));
System.out.println("JavaµÄÔËÐл·¾³¹©Ó¦ÉÌ£º"+props.getProperty("java.vendor"));
System.out.println("Java¹©Ó¦É̵ÄURL£º"+props.getProperty("java.vendor.url"));
System.out.println("JavaµÄ°²×°Â·¾¶£º"+props.getProperty("java.home"));
System.out.println("JavaµÄÐéÄâ»ú¹æ·¶°æ±¾£º"+props.getProperty("java.vm.specification.version"));
System.out.println("JavaµÄÐéÄâ»ú¹æ·¶¹©Ó¦ÉÌ£º"+props.getProperty("java.vm.specification.vendor"));
System.out.println("JavaµÄÐéÄâ»ú¹æ·¶Ãû³Æ£º"+props.getProperty("java.vm.specification.name"));
System.out.println("JavaµÄÐéÄâ»úʵÏÖ°æ±¾£º"+props.getProperty("java.vm.version"));
System.out.println("JavaµÄÐ ......