Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JavaÕ»Óë¶Ñ

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¸ö³ÌÐò¿éÀïÃ棬³ÌÐò¿éÍ˳öºó£¬×Ö¶ÎÖµ¾ÍÏûʧÁË)£¬³öÓÚ×·ÇóËٶȵÄÔ­Òò£¬¾Í´æÔÚÓÚÕ»ÖС£
ÁíÍ⣬ջÓÐÒ»¸öºÜÖØÒªµÄÌØÊâÐÔ£¬¾ÍÊÇ´æÔÚÕ»ÖеÄÊý¾Ý¿ÉÒÔ¹²Ïí¡£¼ÙÉèÎÒÃÇͬʱ¶¨Ò壺
¸´ÖÆÄÚÈݵ½¼ôÌù°å´úÂë:
int a = 3;
int b = 3£»
±àÒëÆ÷ÏÈ´¦Àíint a = 3£»Ê×ÏÈËü»áÔÚÕ»Öд´½¨Ò»¸ö±äÁ¿ÎªaµÄÒýÓã¬È»ºó²éÕÒÓÐûÓÐ×ÖÃæֵΪ3µÄµØÖ·£¬Ã»ÕÒµ½£¬¾Í¿ª±ÙÒ»¸ö´æ·Å3Õâ¸ö×ÖÃæÖµµÄµØÖ·£¬È»ºó½«aÖ¸Ïò3µÄµØÖ·¡£½Ó×Å´¦Àíint b = 3£»ÔÚ´´½¨ÍêbµÄÒýÓñäÁ¿ºó£¬ÓÉÓÚÔÚÕ»ÖÐÒѾ­ÓÐ3Õâ¸ö×ÖÃæÖµ£¬±ã½«bÖ±½ÓÖ¸Ïò3µÄµØÖ·¡£ÕâÑù£¬¾Í³öÏÖÁËaÓëbͬʱ¾ùÖ¸Ïò3µÄÇé¿ö¡£
Ìرð×¢ÒâµÄÊÇ£¬ÕâÖÖ×ÖÃæÖµµÄÒýÓÃÓëÀà¶ÔÏóµÄÒýÓò»Í¬¡£¼Ù¶¨Á½¸öÀà¶ÔÏóµÄÒýÓÃͬʱָÏòÒ»¸ö¶ÔÏó£¬Èç¹ûÒ»¸ö¶ÔÏóÒýÓñäÁ¿ÐÞ¸ÄÁËÕâ¸ö¶ÔÏóµÄÄÚ²¿×´Ì¬£¬ÄÇôÁíÒ»¸ö¶ÔÏóÒýÓñäÁ¿Ò²¼´¿Ì·´Ó³³öÕâ¸ö±ä»¯¡£Ïà·´£¬Í¨¹ý×ÖÃæÖµµÄÒýÓÃÀ´ÐÞ¸ÄÆäÖµ£¬²»»áµ¼ÖÂÁíÒ»¸öÖ¸Ïò´Ë×ÖÃæÖµµÄÒýÓõÄÖµÒ²¸úןıäµÄÇé¿ö¡£ÈçÉÏÀý£¬ÎÒÃǶ¨ÒåÍêaÓëbµÄÖµºó£¬ÔÙÁîa=4£»ÄÇô£¬b²»»áµÈÓÚ4£¬»¹ÊǵÈÓÚ3¡£ÔÚ±àÒëÆ÷ÄÚ²¿£¬Óöµ½a=4£»Ê±£¬Ëü¾Í»áÖØÐÂËÑË÷Õ»ÖÐÊÇ·ñÓÐ4µÄ×ÖÃæÖµ£¬Èç¹ûûÓУ¬ÖØпª±ÙµØÖ·´æ·Å4µÄÖµ£»Èç¹ûÒѾ­ÓÐÁË£¬ÔòÖ±½Ó½«aÖ¸ÏòÕâ¸öµØÖ·¡£Òò´ËaÖµµÄ¸Ä±ä²»»áÓ°Ïìµ½bµÄÖµ¡£
ÁíÒ»ÖÖÊÇ°ü×°ÀàÊý¾Ý£¬ÈçInteger, String, DoubleµÈ½«ÏàÓ¦µÄ»ù±¾Êý¾ÝÀàÐÍ°ü×°ÆðÀ´µÄÀà¡£ÕâЩÀàÊý¾ÝÈ«²¿´æÔÚÓÚ¶ÑÖУ¬JavaÓÃne


Ïà¹ØÎĵµ£º

Java Éè¼Æģʽ(12)

Observer
Intent
Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
How to
Subject
  
knows its observers. Any number of Observer objects may observe a subject.
  
provides an in ......

javaÖеÄ̰ʳÉßÀý³Ì

×î½üÒªÖØÐÂѧϰJava£¬ÕÒ¸öÀý×ÓÀ´Êµ¼ù£¬ÔÚÍøÉÏÕÒÁ˺ܶàÀý³ÌÀ´¿´£¬×Ô¼ºÖØбàдÁËÒ»¸ö̰ʳÉßµÄÀý×Ó£¬¼ÇÔÚÕâÀï¡£
1.SnakeModel.java
import java.util.Observable;
import java.util.LinkedList;
import java.util.Arrays;
import java.util.Random;
import javax.swing.*;
//ObservableÀàÒ»°ã´ú±íÊý¾Ý£¬ÊµÏÖ½Ó¿ÚRunna ......

ʹÓÃJAVAͨ¹ýJXL(JExcel)¶¯Ì¬Éú³ÉExcelÎļþ


 
ÉÏ´Î談過ÁËʹÓÃiText產ÉúPDF檔£¬這´Î換³É來談談ʹÓÃJExcel來產ÉúEXCEL檔µÄ·½·¨¡£
Ê×ÏÈ£¬Ïȵ½ËûµÄSourceForgeÖ÷頁ÃædownloadÏà關µÄAPI檔°¸¡£
http://sourceforge.net/projects/jexcelapi/
»ò
http://www.andykhan ......

java native interface(JNI)¼¼Êõ¼òµ¥Ó¦ÓÃ

      ÊÖÉÏÒ»¸öÏîÄ¿ÐèҪͨ¹ýusb¿ÚÈ¥¶ÁÈ¡usbkeyµÄÐÅÏ¢£¬³§¼ÒÌṩµÄÖ»ÓÐC/C++µÄ½Ó¿Ú£¬¶øÖ÷Ó¦ÓÃÊÇjavaµÄ£¬ËùÒÔÐèҪʹÓÃjavaÈ¥µ÷Óö¯Ì¬Á´½Ó¿â£¬ËùÒÔ»¨Á˵ãʱ¼äÑо¿ÁËÏÂJNI¼¼Êõ£¬jdk¶ÔJNI¼¼Êõ·â×°µÃºÜµ½Î»£¬Ê¹ÓÃÆðÀ´·Ç³£¼òµ¥£¬JNI¼¼Êõ×î¹Ø¼ü»¹ÊÇÔÚÓÚjniÊý¾ÝÀàÐͺͱ¾µØÊý¾ÝÀàÐ͵Äת»»¡£Ïȼòµ¥ÂÞÁÐÏÂJNIµ ......

JavaÉè¼Æģʽ֮State(״̬ģʽ)

¶¨Ò壺
GOF¡¶Éè¼Æģʽ¡·Öиø״̬ģʽϵĶ¨ÒåΪ£ºÔÊÐíÒ»¸ö¶ÔÏóÔÚÆäÄÚ²¿×´Ì¬¸Ä±äʱ¸Ä±äËüµÄÐÐΪ¡£
ÏÈ¿´Ò»¸öÀý×Ó£º
package com.state;
public class KissingPrincess {
// ±ê־룬±êÖ¾ÊÇÇàÍÜ»¹ÊÇÍõ×Ó¡£
private boolean isFrog = true;
// ¸ù¾ÝisFrog½øÐв»Í¬µÄ²Ù×÷¡£
public void greet() {
if (isFrog)
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ