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

java¶ÔString×Ö·û´®¶ÔÏóµÄ´´½¨ÒÔ¼°¹ÜÀí

(Ô­´´)ÉîÈëÑо¿java¶ÔString×Ö·û´®¶ÔÏóµÄ´´½¨ÒÔ¼°¹ÜÀí
(2008-9-27 bbh)
ÐÂÊÖ³õѧ,²»¶ÔµÄµØ·½´ó¼Ò¶à¶àÖ¸½Ì~
¾­³£¿´µ½ºÜ¶àÈËÌÖÂÛjavaÖйØÓÚStringµÄÎÊÌâ,ÎÒÒ²¾ÍÓеãÐËȤÁË,¼øÓÚÍøÉϺܶàÈËдµÄ¶¼²î±ðºÜ´ó,
ͬÑùµÄÎÊÌⶼÊDz»Í¬µÄ˵·¨,ÎÒºÜÃÔºý,»¨ÁËÒ»ÍíÉ϶ÁÁËJava Virtual Machine SpecificationºÍ
The Java Language SpecificationµÄһЩÕ½Ú,×öÁ˺ܶàÊÔÑé,×ܽáÁËһϹØÓÚStringµÄÄÚÈÝ,»¹
ÓкܶàÄÚÈÝÎÒÒ²²»È·¶¨,ÔÚÏÂÃæÒ²¶¼Ìá³öÀ´ÁË,Ï£Íû¸ßÊÖÄÜÖ¸Õý.
Constant Pool³£Á¿³ØµÄ¸ÅÄî:
ÔÚ½²µ½StringµÄһЩÌØÊâÇé¿öʱ,×Ü»áÌáµ½String Pool»òÕßConstant Pool,µ«ÊÇÎÒÏëºÜ¶àÈ˶¼²»Ì«
Ã÷°×Constant Poolµ½µ×ÊǸöÔõôÑùµÄ¶«Î÷,ÔËÐеÄʱºò´æ´¢ÔÚÄÄÀï,ËùÒÔÔÚÕâÀïÏÈ˵һÏÂConstant PoolµÄÄÚÈÝ.
String PoolÊǶÔÓ¦ÓÚÔÚConstant PoolÖд洢String³£Á¿µÄÇøÓò.Ï°¹ß³ÆΪString Pool,Ò²ÓÐÈ˳ÆΪ
String Constant Pool.ºÃÏñûÓÐÕýʽµÄÃüÃû??
ÔÚjava±àÒëºÃµÄclassÎļþÖÐ,ÓиöÇøÓò³ÆΪConstant Pool,ËûÊÇÒ»¸öÓÉÊý×é×é³ÉµÄ±í,ÀàÐÍ
Ϊcp_info constant_pool[],ÓÃÀ´´æ´¢³ÌÐòÖÐʹÓõĸ÷ÖÖ³£Á¿,°üÀ¨Class/String/IntegerµÈ¸÷
ÖÖ»ù±¾JavaÊý¾ÝÀàÐÍ,ÏêÇé²Î¼ûThe Java Virtual Machine Specification 4.4Õ½Ú.
¶ÔÓÚConstant Pool,±íµÄ»ù±¾Í¨ÓýṹΪ:
cp_info {
        u1 tag;
        u1 info[];
}
tagÊÇÒ»¸öÊý×Ö,ÓÃÀ´±íʾ´æ´¢µÄ³£Á¿µÄÀàÐÍ,ÀýÈç8±íʾStringÀàÐÍ,5±íʾLongÀàÐÍ,info[]¸ù¾Ý
ÀàÐÍÂëtagµÄ²»Í¬»á·¢ÉúÏàÓ¦±ä»¯.
¶ÔÓÚStringÀàÐÍ,±íµÄ½á¹¹Îª:
CONSTANT_String_info {
        u1 tag;
        u2 string_index;
}
tag¹Ì¶¨Îª8,string_indexÊÇ×Ö·û´®ÄÚÈÝÐÅÏ¢,ÀàÐÍΪ:
CONSTANT_Utf8_info {
        u1 tag;
        u2 length;
        u1 bytes[length];
}
tag¹Ì¶¨Îª1,lengthΪ×Ö·û´®µÄ³¤¶È,bytes[length]Ϊ×Ö·û´®µÄÄÚÈÝ.
(ÒÔÏ´úÂëÔÚjdk6ÖбàÒë)
ΪÁËÏêϸÀí½âConstant PoolµÄ½á¹¹,ÎÒÃDzο´Ò»Ð©´úÂë:
    String s1 = "sss111";
    String s2 = "sss222";
    System.out.println(s1 + " " + s2);
ÓÉÓÚ"sss111"ºÍ"sss222"¶¼Ê


Ïà¹ØÎĵµ£º

JAVA²Ù×÷cookie

È¡:
Cookie[] cookies = request.getCookies();
 if(cookies!=null){
    for(Cookie cookie : cookies){
   if(cookie.getName().equals("mid")){
    String mid = cookie.getValue();
   }
  }
 }
´æ:
String mid ......

¶¯Ì¬Éú³ÉjavaÎļþµÄ·½·¨

package com.hongsoft.test;
import java.io.*;
//¶¨ÖƵÄÀà×°ÈëÆ÷
public class TestCompile extends ClassLoader
{
String _compiler;
String _classpath;
public static void main(String[] args)
{
new TestCompile();
}
public TestCompile()
{
super(ClassLoader.getSystemClassLoader());
//ĬÈϱàÒëÆ ......

»ùÓÚmvcµÄjava webÉè¼ÆÓ뿪·¢


µÚ1Õ strutsÓëjava webÓ¦Óüò½é
1.1 java webÓ¦ÓøÅÊö
1.2 web×é¼þµÄÈýÖÖ¹ØÁª¹Øϵ
1.3 muv¸ÅÊö
1.4 struts¸ÅÊö
1.4.1 strutsʵÏÖmvcµÄ»úÖÆ
ÔÚstruts¿ò¼ÜÖУ¬Ä£ÐÍÓÉʵÏÖÒµÎñÂß¼­µÄjavabean»òejb×é¼þ¹¹³É£¬¿ØÖÆÆ÷ÓÉ
ActionServletºÍActionÀàʵÏÖ£¬ÊÓͼÓÉÒ»×éjspÎļþ¹¹³É¡£
1.ÊÓͼ
ÊÓͼ¾ÍÊÇjspÎļþ¡£ÔÚÕâЩjspÎļþ ......

Java ÀûÓÃÌ×½Ó×ÖSocketʵÏÖ¼òµ¥µÄ·þÎñÆ÷Óë¿Í»§¶ËͨÐÅ

ÎÒÃÇҪʵÏֵľßÌ幦ÄÜÊÇ£º
ÀûÓÃSocketÀàºÍServerSocketÀà±àдһ¸öC/S³ÌÐò£¬ÊµÏÖC/SͨÐÅ¡£
¿Í»§¶ËÏò·þÎñÆ÷¶Ë·¢ËÍTimeÃüÁ·þÎñÆ÷¶Ë½ÓÊܵ½¸Ã×Ö·û´®ºó½«·þÎñÆ÷¶Ëµ±Ç°Ê±¼ä·µ»Ø¸ø¿Í»§¶Ë£»¿Í»§¶ËÏò·þÎñÆ÷¶Ë·¢ËÍExitÃüÁ·þÎñÆ÷¶ËÏò¿Í»§¶Ë·µ»Ø“Bye”ºóÍ˳ö¡£
ÌâÄ¿±È½Ï¼òµ¥µÄ£¬ÎÒÃÇÖ±½ÓÀ´¿´´úÂë°É£º
Ê×ÏÈÊÇ·þÎñÆ÷¶ ......

JAVA»­³öwavÒôƵ²¨ÐÎͼ


×ֺţº´ó ÖРС
import java.awt.Graphics;
import java.io.File;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.SourceDataLine;
public class M ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ