Java¶àÏ̱߳à³ÌÏê½â
Ò»£ºÀí½â¶àÏß³Ì
¶àÏß³ÌÊÇÕâÑùÒ»ÖÖ»úÖÆ£¬ËüÔÊÐíÔÚ³ÌÐòÖв¢·¢Ö´Ðжà¸öÖ¸ÁîÁ÷£¬Ã¿¸öÖ¸ÁîÁ÷¶¼³ÆΪһ¸öỊ̈߳¬±Ë´Ë¼ä»¥Ïà¶ÀÁ¢¡£
Ïß³ÌÓÖ³ÆΪÇáÁ¿¼¶½ø³Ì£¬ËüºÍ½ø³ÌÒ»ÑùÓµÓжÀÁ¢µÄÖ´ÐпØÖÆ£¬ÓɲÙ×÷ϵͳ¸ºÔðµ÷¶È£¬Çø±ðÔÚÓÚÏß³ÌûÓжÀÁ¢µÄ´æ´¢¿Õ¼ä£¬¶øÊǺÍËùÊô½ø³ÌÖеÄÆäËüÏ̹߳²ÏíÒ»¸ö´æ´¢¿Õ¼ä£¬ÕâʹµÃÏ̼߳äµÄͨÐÅÔ¶½Ï½ø³Ì¼òµ¥¡£
¶à¸öÏ̵߳ÄÖ´ÐÐÊDz¢·¢µÄ£¬Ò²¾ÍÊÇÔÚÂß¼Éϓͬʱ”£¬¶ø²»¹ÜÊÇ·ñÊÇÎïÀíÉϵēͬʱ”¡£Èç¹ûϵͳֻÓÐÒ»¸öCPU£¬ÄÇôÕæÕýµÄ“ͬʱ”ÊDz»¿ÉÄܵģ¬µ«ÊÇÓÉÓÚCPUµÄËٶȷdz£¿ì£¬Óû§¸Ð¾õ²»µ½ÆäÖеÄÇø±ð£¬Òò´ËÎÒÃÇÒ²²»ÓùØÐÄËü£¬Ö»ÐèÒªÉèÏë¸÷¸öÏß³ÌÊÇͬʱִÐм´¿É¡£
¶àÏ̺߳ʹ«Í³µÄµ¥Ïß³ÌÔÚ³ÌÐòÉè¼ÆÉÏ×î´óµÄÇø±ðÔÚÓÚ£¬ÓÉÓÚ¸÷¸öÏ̵߳ĿØÖÆÁ÷±Ë´Ë¶ÀÁ¢£¬Ê¹µÃ¸÷¸öÏß³ÌÖ®¼äµÄ´úÂëÊÇÂÒÐòÖ´Ðеģ¬ÓÉ´Ë´øÀ´µÄÏ̵߳÷¶È£¬Í¬²½µÈÎÊÌ⣬½«ÔÚÒÔºó̽ÌÖ¡£
¶þ£ºÔÚJavaÖÐʵÏÖ¶àÏß³Ì
ÎÒÃDz»·ÁÉèÏ룬ΪÁË´´½¨Ò»¸öеÄỊ̈߳¬ÎÒÃÇÐèÒª×öЩʲô£¿ºÜÏÔÈ»£¬ÎÒÃDZØÐëÖ¸Ã÷Õâ¸öÏß³ÌËùÒªÖ´ÐеĴúÂ룬¶øÕâ¾ÍÊÇÔÚJavaÖÐʵÏÖ¶àÏß³ÌÎÒÃÇËùÐèÒª×öµÄÒ»ÇУ¡
ÕæÊÇÉñÆ棡JavaÊÇÈçºÎ×öµ½ÕâÒ»µãµÄ£¿Í¨¹ýÀ࣡×÷Ϊһ¸öÍêÈ«ÃæÏò¶ÔÏóµÄÓïÑÔ£¬JavaÌṩÁËÀà java.lang.Thread À´·½±ã¶àÏ̱߳à³Ì£¬Õâ¸öÀàÌṩÁË´óÁ¿µÄ·½·¨À´·½±ãÎÒÃÇ¿ØÖÆ×Ô¼ºµÄ¸÷¸öỊ̈߳¬ÎÒÃÇÒÔºóµÄÌÖÂÛ¶¼½«Î§ÈÆÕâ¸öÀà½øÐС£
ÄÇôÈçºÎÌṩ¸ø Java ÎÒÃÇÒªÏß³ÌÖ´ÐеĴúÂëÄØ£¿ÈÃÎÒÃÇÀ´¿´Ò»¿´ Thread Àà¡£Thread Àà×îÖØÒªµÄ·½·¨ÊÇ run() £¬ËüΪThread ÀàµÄ·½·¨ start() Ëùµ÷Óã¬ÌṩÎÒÃǵÄÏß³ÌËùÒªÖ´ÐеĴúÂ롣ΪÁËÖ¸¶¨ÎÒÃÇ×Ô¼ºµÄ´úÂ룬ֻÐèÒª¸²¸ÇËü£¡
·½·¨Ò»£º¼Ì³Ð Thread À࣬¸²¸Ç·½·¨ run()
ÎÒÃÇÔÚ´´½¨µÄ Thread ÀàµÄ×ÓÀàÖÐÖØд run() ,¼ÓÈëÏß³ÌËùÒªÖ´ÐеĴúÂë¼´¿É¡£
ÏÂÃæÊÇÒ»¸öÀý×Ó£º
public class MyThread extends Thread {
int count= 1, number;
public MyThread(int num) {
number = num;
System.out.println("´´½¨Ïß³Ì " + number);
}
public void run() {
while(true) {
System.out.println("Ïß³Ì " + number + ":¼ÆÊý " + count);
if(++count== 6) return;
}
}
public static void main(String args[]) {
for(int i = 0; i < 5; i++) new MyThread(i+1).start();
}
}
ÕâÖÖ·½·¨¼òµ¥Ã÷ÁË£¬·ûºÏ´ó¼ÒµÄÏ°¹ß£¬µ«ÊÇ£¬ËüÒ²ÓÐÒ»¸öºÜ´óµÄȱµã£¬ÄǾÍÊÇÈç¹ûÎÒÃǵÄÀàÒѾ´ÓÒ»¸öÀà¼Ì³Ð£¨ÈçС³ÌÐò±ØÐë¼Ì³Ð×Ô Applet Àࣩ£¬ÔòÎÞ·¨Ôټ̳РThread À࣬ÕâʱÈç¹ûÎÒÃÇÓÖ²»Ïë½
Ïà¹ØÎĵµ£º
Http´¦Àí²½Öè:
1.¿Í»§¶ËºÍWeb·þÎñÆ÷½¨Á¢Á¬½Ó;
2.¿Í»§¶Ë·¢ËÍhttpÇëÇó;
3.·þÎñÆ÷¶Ë½ÓÊÕ¿Í»§¶ËµÄhttpÇëÇó,Éú³ÉhttpÏìÓ¦»Ø·¢;
4.·þÎñÆ÷¹Ø±ÕÁ¬½Ó.
ÇëÇó:ÇëÇóÐÐ,ÇëÇóÍ·,¿ÕÐÐ,ÏûÏ¢Ìå.
ÏìÓ¦:״̬ÐÐ,ÏìӦͷ,¿ÕÐÐ,ÏûÏ¢Ìå.
Servlet:
Ìصã:1.ÆÕͨµÄJava´úÂë,ʹÓÃÁËеÄAPI;
2.²»ÊôÓÚJ2SE,¾ßÓе¥¶ÀµÄ¹æ·¶;
3.¼Ì³ÐÓÚHttpS ......
Javaƽ̨ÌṩÁËÒ»¸öȫеļ¯ºÏ¿ò¼Ü¡£“¼¯ºÏ¿ò¼Ü”Ö÷ÒªÓÉÒ»×éÓÃÀ´²Ù×÷¶ÔÏóµÄ½Ó¿Ú×é³É¡£²»Í¬½Ó¿ÚÃèÊöÒ»×鲻ͬÊý¾ÝÀàÐÍ¡£
Java 2¼¯ºÏ¿ò¼Üͼ
¼¯ºÏ½Ó¿Ú£º6¸ö½Ó¿Ú£¨¶ÌÐéÏß±íʾ£©£¬±íʾ²»Í¬¼¯ºÏÀàÐÍ£¬ÊǼ¯ºÏ¿ò¼ÜµÄ»ù´¡¡£
³éÏóÀࣺ5¸ö³éÏóÀࣨ³¤ÐéÏß±íʾ£©£¬¶Ô¼¯ºÏ½Ó¿ÚµÄ²¿·ÖʵÏÖ¡£¿ÉÀ©Õ¹Îª×Ô¶¨Ò弯ºÏÀà¡£
......
ÓÐÈË·´Ó³¿´²»µ½Ô´Â룬·¢ÏÖÊÇCSDNµÄ´úÂë¿Ø¼þÓÐÎÊÌ⡣ϣÍûCSDNºÃºÃ¸Ä½øһϡ£
ÔÝʱÏÈÒÔÎı¾·½Ê½·¢²¼³öÀ´£¬¸ñʽ»á±äÑù¡£
import java.util.LinkedList;
public class ProducerConsumer
{
/**
* @param args
*/
public static void main(String[] args)
{
Queue queue = ......
finalize·½·¨
ËüÊÇjava.lang.ObjectÀàÖеķ½·¨. ÊÇprotectedµÄ.
ȱʡʱÕâ¸ö·½·¨ÊÇ¿ÕµÄ. JavaÔËÐÐϵͳÔÚÀ¬»ø»ØÊÕʱÔÚ¶ÔÏó±»³·Ïú֮ǰµ÷ÓÃÕâ¸ö·½·¨. µ«ÓÉÓÚÀ¬»øµ¥Ôª
»ØÊÕµÄʱ¼äÊDz»È·¶¨µÄ.ËùÒÔ²»Äܹý·ÖÒÀÀµËü(ÕâºÍc++µÄÎö¹¹º¯Êý²»Í¬).
¶øÖ»ÄÜÊÇ"ÔÚ¶ÔÏó±»³·Ïú֮ǰ"×öһЩ´¦Àí.ÀýÈç¿ÉÒÔÔÚÕâÀï¹Ø±Õ¹¹Ôì·½·¨Öдò¿ ......
Ò»¸öjavaÎļþÖУ¬ÓÐÇÒÖ»ÓÐÒ»¸öpublicÀà
float ff= 1.3f;(4B)
int 4B;
long 8B;
double 8B;
byte Ò»×Ö½ÚÕûÐÍ
char 2B
Êý×é
int num[] = new int[3];
int[] num;
num = new int[3];
int [] num = new int[]{1,2,3};
int [][] num;
num = new int[3][4];
//²»Í¬³¤
num = new int[3][];
num[0] = new int[5]; ......