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

javaÖÐ ×î³£ÓõÄString µÄÓ÷¨

String : ×Ö·û´®ÀàÐÍ
Ò»¡¢¹¹Ô캯Êý
String(byte[ ] bytes)£ºÍ¨¹ýbyteÊý×é¹¹Ôì×Ö·û´®¶ÔÏó¡£
String(char[ ] value)£ºÍ¨¹ýcharÊý×é¹¹Ôì×Ö·û´®¶ÔÏó¡£
String(Sting original)£º¹¹ÔìÒ»¸öoriginalµÄ¸±±¾¡£¼´£º¿½±´Ò»¸öoriginal¡£
String(StringBuffer buffer)£ºÍ¨¹ýStringBufferÊý×é¹¹Ôì×Ö·û´®¶ÔÏó¡£
ÀýÈ磺
byte[] b = {'a','b','c','d','e','f','g','h','i','j'};
char[] c = {'0','1','2','3','4','5','6','7','8','9'};
String sb = new String(b); //abcdefghij
String sb_sub = new String(b,3,2); //de
String sc = new String(c); //0123456789
String sc_sub = new String(c,3,2); //34
String sb_copy = new String(sb); //abcdefghij
System.out.println("sb:"+sb);
System.out.println("sb_sub:"+sb_sub);
System.out.println("sc:"+sc);
System.out.println("sc_sub:"+sc_sub);
System.out.println("sb_copy:"+sb_copy);
Êä³ö½á¹û£ºsb:abcdefghij
sb_sub:de
sc:0123456789
sc_sub:34
sb_copy:abcdefghij
¶þ¡¢·½·¨£º
˵Ã÷£º¢Ù¡¢ËùÓз½·¨¾ùΪpublic¡£
¢Ú¡¢Êéд¸ñʽ£º [ÐÞÊηû] <·µ»ØÀàÐÍ><·½·¨Ãû([²ÎÊýÁбí])>
ÀýÈ磺static int parseInt(String s)
±íʾ´Ë·½·¨(parseInt)ΪÀà·½·¨(static),·µ»ØÀàÐÍΪ(int),·½·¨ËùÐèҪΪStringÀàÐÍ¡£
1. char charAt(int index) £ºÈ¡×Ö·û´®ÖеÄijһ¸ö×Ö·û£¬ÆäÖеIJÎÊýindexÖ¸µÄÊÇ×Ö·û´®ÖÐÐòÊý¡£×Ö·û´®µÄÐòÊý´Ó0¿ªÊ¼µ½length()-1 ¡£
ÀýÈ磺String s = new String("abcdefghijklmnopqrstuvwxyz");
System.out.println("s.charAt(5): " + s.charAt(5) );
½á¹ûΪ£º s.charAt(5): f
2. int compareTo(String anotherString) £ºµ±Ç°String¶ÔÏóÓëanotherString±È½Ï¡£ÏàµÈ¹Øϵ·µ»Ø£°£»²»ÏàµÈʱ£¬´ÓÁ½¸ö×Ö·û´®µÚ0¸ö×Ö·û¿ªÊ¼±È½Ï£¬·µ»ØµÚÒ»¸ö²»ÏàµÈµÄ×Ö·û²î£¬ÁíÒ»ÖÖÇé¿ö£¬½Ï³¤×Ö·û´®µÄÇ°Ã沿·ÖÇ¡ÇÉÊǽ϶̵Ä×Ö·û´®£¬·µ»ØËüÃǵij¤¶È²î¡£
3. int compareTo(Object o) £ºÈç¹ûoÊÇString¶ÔÏ󣬺Í2µÄ¹¦ÄÜÒ»Ñù£»·ñÔòÅ׳öClassCastExceptionÒì³£¡£
ÀýÈç:String s1 = new String("abcdefghijklmn");
String s2 = new String("abcdefghij");
String s3 = new String("abcdefghijalmn");
System.out.println("s1.compareTo(s2): " + s1.compareTo(s2) ); //·µ»Ø³¤¶È²î
System.out.println("s1.compareTo(s3): " + s1.compareTo(s3) ); //·µ»Ø'k'-'a'µÄ²î
½á¹ûΪ£ºs1.compareTo(s


Ïà¹ØÎĵµ£º

Õë¶Ôjava»­ÃæÉÁ˸


     ÈçÌ⣡½â¾öµÄ·½·¨ÊÇÔö¼ÓÒ»¸öÐé±³¾°¡£Ö®ºó°ÑÐé±³¾°Ôö¼Óµ½Ô­À´µÄFrameÉÏ¡£ÓÉÓÚrepaint()µ½paint()ÖмäÉæ¼°µ½update(),ËùÒÔ½â¾öÎÊÌâµÄ
¹Ø¼üÊÇÔÚÖØдupdate(),ÔÚÕâ¸ö·½·¨ÖÐʵÏÖÐé±³¾°µÄÌí¼Ó~~
   @Override
public void update(Graphics g) 
{
if(offScreenImage == null) ......

jakarta regexp (java strutsÕýÔò±í´ïʽ)


  Character Classes
      [abc]                  Simple character class
      [a-zA-Z]            ......

java È«ÅÅÁÐËã·¨

 import java.util.Arrays;
/**
 * ÇóÒ»¸öÊý×éµÄÈ«ÅÅÁÐËã·¨
 * @author Administrator
 */
public class Pai { 
 public void pai(char[] array,int start,int end){
  System.out.println(" -- ×éºÏ "+start+" µ½ "+end+" --");
  if(start==end){
  ......

Java¶ÁдtxtÎļþ

 ±ÊÊÔµÄʱºòÏë²»ÆðÀ´ÔõôдÁË¡£Áô¸ö´úÂë×÷¼ÍÄî
package common;
import java.io.*;
import java.util.ArrayList;
public class IOTest {
public static void main (String args[]) {

ReadDate();

WriteDate();

}

/**
* ¶ÁÈ¡Êý¾Ý
*/
public static void ReadDate() {
......

Java BeanÔ­ÀíÓëÓ¦ÓÃ

   ¡¡¡¡1¡¢Ê²Ã´ÊÇJavaBean£¿  
   
  ¡¡¡¡JavaBeanÊÇÃèÊöJavaµÄÈí¼þ×é¼þÄ£ÐÍ£¬ÓеãÀàËÆÓÚMicrosoftµÄCOM×é¼þ¸ÅÄî¡£ÔÚJavaÄ£ÐÍÖУ¬Í¨¹ýJavaBean¿ÉÒÔÎÞÏÞÀ©³äJava³ÌÐòµÄ¹¦ÄÜ£¬Í¨¹ýJavaBeanµÄ×éºÏ¿ÉÒÔ¿ìËÙµÄÉú³ÉеÄÓ¦ÓóÌÐò¡£¶ÔÓÚ³ÌÐòÔ±À´Ëµ£¬×îºÃµÄÒ»µã¾ÍÊÇJavaBean¿ÉÒÔʵÏÖ´úÂëµÄÖظ´ÀûÓ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ