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

JavaÖеÄ×Ö·û±àÂëÓë½âÂë(ת)

ת http://jiangzhengjun.javaeye.com/blog/506952
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import junit.framework.TestCase;
/**
* ±àÂëÓë½âÂë²âÊÔ
* @author jzj
*/
public class TestEncodeDecode extends TestCase {
 private char chineseChar = 'ÖÐ';
 private char englishChar = 'a';
 /**
 * Java³ÌÐòÖеÄ×Ö·û¶¼ÊÇÕ¼Óöþ¸ö×Ö½Ú£¬ÒòΪ char ÀàÐͺñÈË«×Ö½ÚµÄÎÞ·ûºÅÕûÊý
 */
 public void testCharToUnicode() {
  //Ê®½øÖÆUncode±àÂë
  System.out.println((int) chineseChar);//20013
  System.out.println((int) englishChar);//97
  //Ê®Áù½øÖÆUncode±àÂë
  System.out
    .println(Integer.toHexString((int) chineseChar).toUpperCase());//4E2D
  System.out
    .println(Integer.toHexString((int) englishChar).toUpperCase());//61
  //¶þ½øÖÆUncode±àÂë
  System.out.println(Integer.toBinaryString((int) chineseChar));//100111000101101
  System.out.println(Integer.toBinaryString((int) englishChar));//1100001
 }
 /**
 * ²»¹ÜÊÇÖÐÎÄ»¹ÊÇÓ¢ÎĶ¼»¹ÊÇÆäËû×Ö·û£¬Ã¿¸ö×Ö·û¶¼ÊÇÕ¼ÓÃÁ½¸ö×Ö½Ú£¬Ó¢ÎÄ×Ö·ûµÄ
 * UTF-16±àÂëÓëUnicode±àÂëÊÇÒ»ÑùµÄ£¬Ö»²»¹ýUTF-16ÔÚ±àÂëʱ»áÔÚÂëÁ÷Ç°¼ÓÉÏ"FE FF"Á½¸ö×Ö½ÚµÄÄÚÈÝ£¬
 * ±íʾ×Ö·ûÊÇÒÔUTF-16¸ñʽ´æ´¢µÄ£¬ÔÚ¶Áȡʱ³ÌÐò¾Í»áÖªµÀÊÇUTF-16±àÂëµÄ×Ö·û
 */
 public void testCharToUTF16() {
  try {
   //--ÖÐÎÄ×Ö·ûתUTF-16
   byte[] encodeArr = String.valueOf(chineseChar).getBytes("UTF-16");
   //Ê®½øÖƱàÂëÊä³ö
   for (int i = 0; i < encodeArr.length; i++) {
    //-2 -1 78 45
    Syst


Ïà¹ØÎĵµ£º

Effective Java: Item 1

Static Factory Methods
Four Advantages:
1) have names
2) not required to create a new object each time they are invoked
3) return an object of any subtype of their return type
4) reduce the verbosity of creating parameterized type instances.(for example: newInstance() method) ......

Java AppletÓëJava ApplicationµÄÇø±ð

Java AppletÓëJava ApplicationµÄÇø±ð
ÔÚJavaÓïÑÔÖУ¬Äܹ»¶ÀÁ¢ÔËÐеijÌÐò³ÆΪJavaÓ¦ÓóÌÐò£¨Application£©¡£JavaÓïÑÔ»¹ÓÐÁíÍâÒ»ÖÖ³ÌÐò——Applet³ÌÐò¡£Applet³ÌÐò£¨Ò²³ÆJavaС³ÌÐò£©ÊÇÔËÐÐÓÚ¸÷ÖÖÍøÒ³ÎļþÖУ¬ÓÃÓÚÔöÇ¿ÍøÒ³µÄÈË»ú½»»¥¡¢¶¯»­ÏÔʾ¡¢ÉùÒô²¥·ÅµÈ¹¦ÄܵijÌÐò¡£
     Java Appletº ......

javaÄÚ²¿Àà¼Ì³ÐʾÀý£¡

package innerClass.test;
public class InheritTest
{
    public static void main(String[] args)
    {
        Person p = new Person("LMS");
        p.show();
      ......

Java Annotation dzÎö1

Annotations
AnnotationsÊÇJ2SE 5.0ÒýÈëµÄÐÂÓïÑÔÌØÐÔ¡£Í¨³££¬ AnnotationsÔÊÐí¿ª·¢ÕßÓÃÒ»ÖÖ¸úÔËÐдúÂëÎ޹صĴÎÒªÐÅÏ¢À´±ê×¢À࣬·½·¨ÒÔ¼°³ÉÔ±¡£ÕâÑù¾Í¿ÉÒÔʹÓÃÀàËÆÆÀ¼ÛµÄ Annotations£¬±ÈÈ瓺÷½·¨”¡¢“»µ·½·¨”£¬»òÕ߸üÏêϸһЩ£¬“²»ÍƼöµÄ·½·¨”¡¢“¸²Ð´µÄ·½·¨&rdq ......

Java¼æÈÝÐÔÓ밲ȫÐÔÉèÖÃ


    ΪÁËʹ²Ù×÷ϵͳ֧³ÖJava£¬¿ÉÓÉSun¹«Ë¾µÄJavaÏÂÔØÍøÒ³, ¸ù¾Ý²Ù×÷ϵͳÀàÐÍÏÂÔغͰ²×°Ò»¸öÃâ·ÑJRE(Java Runtime Environment), ÀýÈç, JRE6¡£È»ºó, ½«±¾ÎļþÏÂÔر£´æ, ¿½±´, ²¢Õ³Ìùµ½JREËùÔÚµÄsecurityĿ¼, ÀýÈç, C:/Program Files/Java/jre6/lib/security/, Ìæ»»Ô­ÓеÄÎļþjava.policy, ÉèÖÃJREÍê³É¡£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ