JAVA×Ô¶¯×°ÏäÓë²ðÏä
×Ô¶¯×°ÏäÓë²ðÏäµÄ¹¦ÄÜÊÂʵÉÏÊDZàÒëÆ÷À´°ïÄúµÄ棬±àÒëÆ÷ÔÚ±àÒëʱÆÚÒÀÄúËù±àдµÄÓï·¨£¬¾ö¶¨ÊÇ·ñ½øÐÐ×°Ïä»ò²ðÏ䶯×÷¡£ÀýÈ磺
Integer i = 100.Ï൱ÓÚ±àÒëÆ÷×Ô¶¯ÎªÄú×÷ÒÔϵÄÓï·¨±àÒ룺
Integer i = new Integer(100).ËùÒÔ×Ô¶¯×°ÏäÓë²ðÏäµÄ¹¦ÄÜÊÇËùνµÄ“±àÒëÆ÷ÃÛÌÇ”(Compiler Sugar)£¬ËäȻʹÓÃÕâ¸ö¹¦Äܷܺ½±ã£¬µ«ÔÚ³ÌÐòÔËÐн׶ÎÄúµÃÁ˽âJavaµÄÓïÒå¡£ÀýÈçÏÂÃæµÄ³ÌÐòÊÇ¿ÉÒÔͨ¹ý±àÒëµÄ£º
Integer i = null.int j = i.ÕâÑùµÄÓï·¨ÔÚ±àÒëʱÆÚÊǺϷ¨µÄ£¬µ«ÊÇÔÚÔËÐÐʱÆÚ»áÓдíÎó£¬ÒòΪÕâÖÖд·¨Ï൱ÓÚ£º
Integer i = null.int j = i.intValue().null±íʾiûÓвο¼ÖÁÈκεĶÔÏóʵÌ壬Ëü¿ÉÒԺϷ¨µØÖ¸¶¨¸ø¶ÔÏó²Î¿¼Ãû³Æ¡£ÓÉÓÚʵ¼ÊÉÏi²¢Ã»Óвο¼ÖÁÈκεĶÔÏó£¬ËùÒÔÒ²¾Í²»¿ÉÄܲÙ×÷intValue()·½·¨£¬ÕâÑùÉÏÃæµÄд·¨ÔÚÔËÐÐʱ»á³öÏÖNullPointerException´íÎó¡£
×Ô¶¯×°Ïä¡¢²ðÏäµÄ¹¦ÄÜÌṩÁË·½±ãÐÔ£¬µ«Òþ²ØÁËһЩϸ½Ú£¬ËùÒÔ±ØÐëСÐÄ¡£ÔÙÀ´¿´·¶Àý4.6£¬ÄúÈÏΪ½á¹ûÊÇʲôÄØ£¿
ü. ·¶Àý4.6 AutoBoxDemo2.java
public class AutoBoxDemo2 {
public static void main(String[] args) {
Integer i1 = 100.
Integer i2 = 100.
if (i1 == i2)
System.out.println("i1 == i2").
else
System.out.println("i1 != i2").
}
}
´Ó×Ô¶¯×°ÏäÓë²ðÏäµÄ»úÖÆÀ´¿´£¬¿ÉÄÜ»á¾õµÃ½á¹ûÊÇÏÔʾi1 == i2£¬ÄúÊǶԵġ£ÄÇô·¶Àý4.7µÄÕâ¸ö³ÌÐò£¬Äú¾õµÃ½á¹ûÊÇʲô£¿
ü. ·¶Àý4.7 AutoBoxDemo3.java
public class AutoBoxDemo3 {
public static void main(String[] args) {
Integer i1 = 200.
Integer i2 = 200.
if (i1 == i2)
System.out.println("i1 == i2").
else
System.out.println("i1 != i2").
}
}
½á¹ûÊÇÏÔʾi1 != i2£¬ÕâÓÐЩÁîÈ˾ªÑÈ£¬Á½¸ö·¶ÀýÓï·¨ÍêÈ«Ò»Ñù£¬Ö»²»¹ý¸Ä¸öÊýÖµ¶øÒÑ£¬½á¹ûÈ´Ïà·´¡£
ÆäʵÕâÓë==ÔËËã·ûµÄ±È½ÏÓйأ¬ÔÚµÚ3ÕÂÖнéÉܹý==ÊÇÓÃÀ´±È½ÏÁ½¸ö»ù±¾Êý¾ÝÀàÐ͵ıäÁ¿ÖµÊÇ·ñÏàµÈ£¬ÊÂʵÉÏ==Ò²ÓÃÓÚÅжÏÁ½¸ö¶ÔÏóÒýÓÃÃû³ÆÊÇ·ñ²Î¿¼ÖÁͬһ¸ö¶ÔÏó¡£
ÔÚ×Ô¶¯×°Ïäʱ¶ÔÓÚÖµ´Ó–128µ½127Ö®¼äµÄÖµ£¬ËüÃDZ»×°ÏäΪInteger¶ÔÏóºó£¬»á´æÔÚÄÚ´æÖб»ÖØÓã¬ËùÒÔ·¶Àý4.6ÖÐʹÓÃ==½øÐбȽÏʱ£¬i1 Óë i2ʵ¼ÊÉϲο¼ÖÁͬһ¸ö¶ÔÏó¡£Èç¹û³¬¹ýÁË´Ó–128µ½127Ö®¼äµÄÖµ£¬±»×°ÏäºóµÄInteger¶ÔÏó²¢²»»á±»ÖØÓ㬼´Ï൱ÓÚÿ´Î×°Ïäʱ¶¼Ð½¨Ò»¸öInteger¶ÔÏó£¬ËùÒÔ·¶Àý4.7ʹÓÃ==½øÐбȽÏʱ£¬i1Óëi2²Î¿¼µÄÊDz»Í¬µÄ¶ÔÏó¡£
ËùÒÔ²»Òª¹ý·ÖÒÀÀµ×Ô¶¯×°ÏäÓë²ðÏ䣬Äú»¹ÊDZØÐëÖªµÀ
Ïà¹ØÎĵµ£º
Java²»ÊÇÍêÃÀµÄ£¬JavaµÄ²»×ã³ýÁËÌåÏÖÔÚÔËÐÐËÙ¶ÈÉÏÒª±È´«Í³µÄC++ÂýÐí¶àÖ®Í⣬JavaÎÞ·¨Ö±½Ó·ÃÎʵ½²Ù×÷ϵͳµ×²ã£¨ÈçϵͳӲ¼þµÈ)£¬Îª´ËJavaʹÓÃnative·½·¨À´À©Õ¹Java³ÌÐòµÄ¹¦ÄÜ¡£
¿ÉÒÔ½«native·½·¨±È×÷Java³ÌÐòͬ£Ã³ÌÐòµÄ½Ó¿Ú£¬ÆäʵÏÖ²½Ö裺
£±¡¢ÔÚJavaÖÐÉùÃ÷native()·½·¨£¬È»ºó±àÒ룻
£²¡¢ÓÃjavah²úÉúÒ»¸ö.hÎļþ£»
£³¡¢Ð´Ò ......
//package ÓéÀÖ;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.text.DecimalFormat;
import javax.swing ......
Ò»¡¢Ð´pdf
ÐèÒª°ü£ºiText-2.1.0.jar
ÖÐÎÄ´¦Àí£ºiTextAsian.jar
1¡¢HelloWorldÀý×Ó
package com.my.file.pdf;
import java.io.FileOutputStream;
import java.io.IOException;
import com.lowagie.text.*;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfWriter;
public class HelloWorld ......
ÔÚÍøÉÏÕÒµÄһЩ×ÊÁÏ~~Ïë´æÆðÀ´~~·½±ãÒÔºó²é¿´
ѧϰJava SwingͼÐλ¯±à³Ì£¬ÎÒÃÇÊ×ÏÈÒªÁ˽âÈý¸ö×î»ù±¾µÄ¸ÅÄ¶¥²ãÈÝÆ÷£¬¿Ø¼þ£¬²¼¾Ö¡£
ÏÂÃæ¾ÍÀ´½éÉÜÒ»ÏÂÕâÈý¸ö»ù±¾¸ÅÄî
1.¶¥²ãÈÝÆ÷
ʲôÊǶ¥²ãÈÝÆ÷£¿µ±ÎÒÃÇʹÓÃJava½øÐÐͼÐαà³ÌµÄʱºò£¬Í¼ÔÚÄÄÀï»æÖÆÄØ£¿ÎÒÃÇÐèÒªÒ»¸öÄܹ»ÌṩͼÐλæÖƵÄÈÝÆ÷£¬ ......
֮ǰд¹ýÒ»¸öʵÏÖÁËijÖÖ¹¦ÄܵÄjava³ÌÐò£¬µ«ÓÉÓÚ½üÈÕ“¹¤×÷”ÐèÒª£¬ÓÖÐèÒªÔÚc/c++ÖÐÖØÐÂʹÓøù¦ÄÜ¡£ÎªÁ˽Úʡʱ¼ä£¬ÎÒ²ÉÈ¡ÁËÔÚc/c++Öе÷ÓÃjava³ÌÐòµÄ·½·¨£¬µ«Ö®Ç°Ã»ÓнӴ¥¹ýÀàËƵĶ«Î÷£¬µ½ÍøÉÏÒ»²é£¬¹ûÈ»ÓÐÀàËƵĶ«Î÷£¬ÐÄÖаµÏ²ing...¡£²éµ½µÄ×ÊÁÏÖÐÓм¸¸ö²»´íµÄÍøÒ³£º
&nbs ......