javaÐÔÄܵÄÓÅ»¯(Èý)
¹ØÓÚÏ̵߳IJÙ×÷£¬Òª×¢ÒâÈçϼ¸¸ö·½Ãæ¡£
(1) ·ÀÖ¹¹ý¶àµÄͬ²½
ÈçÉÏËùʾ£¬²»±ØÒªµÄͬ²½³£³£»áÔì³É³ÌÐòÐÔÄܵÄϽµ¡£Òò´Ë£¬Èç¹û³ÌÐòÊǵ¥Ị̈߳¬ÔòÒ»¶¨²»ÒªÊ¹ÓÃͬ²½¡£
(2)
ͬ²½·½·¨¶ø²»ÒªÍ¬²½Õû¸ö´úÂë¶Î
¡¡¡¡¡¡¶Ôij¸ö·½·¨»òº¯Êý½øÐÐͬ²½±È¶ÔÕû¸ö´úÂë¶Î½øÐÐͬ²½µÄÐÔÄÜÒªºÃ¡£
(3)
¶Ôÿ¸ö¶ÔÏóʹÓöà”Ëø”µÄ»úÖÆÀ´Ôö´ó²¢·¢¡£
Ò»°ãÿ¸ö¶ÔÏó¶¼Ö»ÓÐÒ»¸ö”Ëø”£¬Õâ¾Í±íÃ÷Èç¹ûÁ½¸öÏß³ÌÖ´ÐÐÒ»¸ö¶ÔÏóµÄÁ½¸ö²»Í¬µÄͬ²½·½·¨Ê±£¬»á·¢Éú”ËÀËø”¡£¼´Ê¹ÕâÁ½¸ö·½·¨²¢²»¹²ÏíÈκÎ×ÊÔ´¡£ÎªÁ˱ÜÃâÕâ
¸öÎÊÌ⣬¿ÉÒÔ¶ÔÒ»¸ö¶ÔÏóʵÐД¶àËø”µÄ»úÖÆ¡£ÈçÏÂËùʾ£º
class foo
{
private static int var1;
private static Object lock1 = new Object();
private static int var2;
private static Object lock2 = new Object();
public static void increment1() {
synchronized (lock1) {
var1++;
}
}
public static void increment2() {
synchronized (lock2) {
var2++;
}
}
}
4£®ÊäÈëºÍÊä³ö(I/O)
ÊäÈëºÍÊä³ö°üÀ¨ºÜ¶à·½Ã棬µ«Éæ¼°×î¶àµÄÊǶÔÓ²ÅÌ
£¬ÍøÂç
»òÊý¾Ý¿âµÄ¶Áд²Ù×÷¡£¶ÔÓÚ¶Áд²Ù×÷£¬ÓÖ·ÖΪÓлº´æºÍûÓлº´æµÄ£»¶ÔÓÚÊý¾Ý¿âµÄ²Ù×÷£¬ÓÖ¿ÉÒÔÓжàÖÖÀàÐ͵Ä
JDBCÇý¶¯
Æ÷¿ÉÒÔÑ¡Ôñ¡£µ«ÎÞÂÛÔõÑù£¬¶¼»á¸ø³ÌÐòµÄÐÔÄÜ´øÀ´Ó°Ïì¡£Òò´Ë£¬ÐèҪעÒâÈçϼ¸µã£º
(1) ʹÓÃÊäÈëÊä³ö»º³å
¡¡¡¡¡¡¾¡¿ÉÄܵĶàʹÓûº´æ¡£µ«Èç¹ûÒª¾³£¶Ô»º´æ½øÐÐˢУ¨flush£©,Ôò½¨Ò鲻ҪʹÓûº´æ¡£
(2) Êä³öÁ÷(Output Stream)ºÍUnicode×Ö·û´®
¡¡¡¡¡¡µ±Ê±ÓÃOutput
StreamºÍUnicode×Ö·û´®Ê±£¬WriteÀàµÄ¿ªÏú±È½Ï´ó¡£ÒòΪËüҪʵÏÖUnicodeµ½×Ö½Ú(byte)µÄת»».Òò´Ë£¬Èç¹û¿ÉÄܵĻ°,ÔÚʹÓÃ
WriteÀà֮ǰ¾ÍʵÏÖת»»»òÓÃOutputStreamÀà´úÌæWriterÀàÀ´Ê¹Óá£
(3)
µ±ÐèÐòÁл¯Ê±Ê¹ÓÃtransient
¡¡¡¡¡¡µ±ÐòÁл¯Ò»¸öÀà»ò¶ÔÏóʱ£¬¶ÔÓÚÄÇЩÔ×ÓÀàÐÍ£¨atomic£©»ò¿ÉÒÔÖؽ¨µÄÔËØÒª±íʶΪ
transientÀàÐÍ¡£ÕâÑù¾Í²»ÓÃÿһ´Î¶¼½øÐÐÐòÁл¯¡£Èç¹ûÕâЩÐòÁл¯µÄ¶ÔÏóÒªÔÚÍøÂçÉÏ´«Ê䣬ÕâһССµÄ¸Ä±ä¶ÔÐÔÄÜ»áÓкܴóµÄÌá¸ß¡£¡¡¡¡
(4) ʹÓøßËÙ»º´æ£¨Cache£©
¡¡¡¡¡¡¶ÔÓÚ
Ïà¹ØÎĵµ£º
1£® ¹ØÓÚ¶¯Ì¬¼ÓÔØ»úÖÆ??
ѧϰJava±ÈC++¸üÈÝÒ×Àí½âOOPµÄ˼Ï룬±Ï¾¹C++»¹»ìºÏÁ˲»ÉÙÃæÏò¹ý³ÌµÄ³É·Ö¡£ºÜ¶àÈ˶¼Äܱ³³öÀ´JavaÓïÑÔµÄÌص㣬ËùνµÄ¶¯Ì¬¼ÓÔØ»úÖƵȵȡ£µ±È»¸ÅÄîÍùÍùÊÇÏȼÇס¶øºóÏû»¯µÄ£¬¿ÉÓжàÉÙÈËÕæÕýÈ¥Ìå»á¹ý¶¯Ì¬¼ÓÔصĻúÖÆ£¬ÊÔͼȥѰÕÒ¹ýÆäÖеÄϸ½ÚÄØ? Ìṩ´ó¼ÒÒ»¸ö·½·¨£º
ÔÚÃüÁîÐд°¿ ......
----------½Ó¿Ú------------
import java.rmi.*;
public interface HelloIn extends java.rmi.Remote{
String sayHello() throws RemoteException;
}
--------ʵÏÖÀà-------------
import java.rmi.*;
import java.net.*;
import java.rmi.registry.*;
import java.rmi.server.*;
public class Hello exten ......
ͨ¹ýjavaµÄ·´Éä»úÖÆ£¬¶¯Ì¬µ÷ÓÃij¸ö·½·¨£º
ÈçÏ£º
public Object invokeMethod(String className, String methodName,
Object[] args) throws Exception{
Class ownerClass = Class.forName(className);
Object owner = ownerClass.newInstance();
Class[] argsClass = new Class[args.length ......
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.RandomAccessFile;
import java.io.Reader;
/**
*
* ¶àÖÖ·½Ê½¶ÁÎ ......
ÎÒ¶ÔÎÊÌâµÄÀí½â£ºÃæÊÔÖеÄÒ»¸öÎÊÌ⣬¾ÓÈ»ÏëÁË°ëÌìûÓÐʲôͷÐ÷£¬ÎÒÏ뻹ÊÇûÓÐ˼¿¼£¬Ã»ÓлýÀÛ¹ý¡£ÆäʵÍêÈ«¿ÉÒÔ˵ÉÏһЩСϸ½Ú£¬±ÈÈçÓÃStringBuffer´úÌæString£¬ÓÃHashMap´úÌæHashtable, ³Ë·¨²Ù×÷ÓÃλÒÆ£¬¾¡Á¿¸´ÓÃÒÑÓеľ¹ý¼ìÑéµÄ¸ßЧ´úÂëµÈµÈ¡£
ÏÂÃæµÄÎÄÕÂתÔØ×Ô±ðµÄÍøÕ¾£¬Ð´µÃºÜרҵ£¬Öܵ½£¬ ......