JAVA×Ö·û´®²Ù×÷
1¡¢ public class HelloWorld {
public static void main(String args[]){
String s="daxiong";
System.out.println("Hello,World!"+"lu shenglong"+s);
char c[]={'s','w','q'};
String u=new String(c);
System.out.println(u);
char ch;
ch=u.charAt(1); //×Ö·û½ØÈ¡º¯Êý
System.out.println(ch);
char cha[]=new char[3];
cha=u.toCharArray();
for(int i=0;i<3;i++)
System.out.print(cha[i]+"¡¢");
}
}
Êä³ö£º
Hello,World!lu shenglongdaxiong
swq
w
s¡¢w¡¢q¡¢
2¡¢JAVAÖГ==”±È½ÏµÄÊǶÔÏóµÄµØÖ·£¬¶øequals()·½·¨±È½ÏµÄÊǶÔÏóµÄÖµ¡£
3¡¢ÐÞ¸Ä×Ö·û´® String e="windows".replace('w','q'); Êä³ö£ºqindoqs
4¡¢trim()·½·¨£º¸Ã·½·¨·µ»ØÒ»¸öµ÷ÓÃ×Ö·û´®µÄ¿½±´£¬½«Î»ÓÚ×Ö·û´®Ç°ÃæºÍºóÃæµÄ¿Õ°××Ö·ûɾȥ£¬Ò»°ãÐÎʽÈçÏ£ºString s=" hello world ".trim();
Êä³ö½á¹ûΪ£ºhello world
Ó¦ÓÃʵÀý;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Test {
public static void main(String args[]) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String str;
System.out.println("Enter'stop'to quit;");
System.out.println("Enter Name:");
do{
str=br.readLine();
str=str.trim();
if(str.equals("Tom"))
System.out.println("Tom is 10 years old.");
}while(!str.equals("stop"));
}
}
Êä³ö£ºEnter'stop'to quit;
Enter Name:
Tom
Tom i
Ïà¹ØÎĵµ£º
꿅᣼ http://blog.csdn.net/justinavril/archive/2008/08/06/2775767.aspx
import
java.io.*;
public
class
FileToString {
public
static
String readFile(String fileName)  ......
¶ÔÓÚObjectÀà,ËüÌṩÁËÒ»¸ö×î×îÑÏÃܵÄʵÏÖ,ÄǾÍÊÇÖ»ÓÐÊÇͬһ¶ÔÏóʱ,equals·½·¨²Å·µ»Øtrue,Ò²¾ÍÊÇÈËÃdz£ËµµÄÒýÓñȽ϶ø²»ÊÇÖµ±È½Ï.Õâ¸öʵÏÖÑÏÃܵÃÒѾûÓÐʲôʵ¼ÊµÄÒâÒå, ËùÒÔÔÚ¾ßÌå×ÓÀà(Ïà¶ÔÓÚObjectÀ´Ëµ)ÖÐ,Èç¹ûÎÒÃÇÒª½øÐжÔÏóµÄÖµ±È½Ï,¾Í±ØÐëʵÏÖ×Ô¼ºµÄequals·½·¨
equals ·½·¨ÊÇ java.lang.Object ÀàµÄ·½·¨¡£
ÓÐÁ½ÖÖÓ ......
¸ö ÈË ¼ò Àú
ÐÕ Ãû£º
ÍõÖ¾¹ú
ÐÔ ±ð£º
ÄÐ
Äê Á䣺
23Ëê
ÁªÏµµç»°£º
13124799190
ר Òµ£º
¼ÆËã»ú¼¼Êõ
¹¤×÷ʱ¼ä£º
Ò»ÄêÒÔÉÏ
ѧ Àú£º
´óר
ÓÊ Ï䣺
andy478168@yeah.net
¡ï ÇóÖ°ÒâÏò
¹¤×÷ÐÔÖÊ ......
×î½üÏë¶ÔÓÚwikiϵͳµÄÔ´´úÂëÑо¿ÏÂ
jspwikiÊÇÒ»¸ö²»´íµÄwikiÒýÇ棬´¿jsp/servletдµÄ¡£JSPWiki²»Ê¹ÓÃÏֳɵÄÊý¾Ý¿â¹ÜÀíÈí¼þ£¬ËùÓеÄÎļþÒÔÎı¾ÎļþµÄÐÎʽ´æ·Å¡£ËüÀûÓÃÀàËÆCVSµÄ»úÖƱ£Ö¤ÁËÎļþ°æ±¾µÄÍêÕûÐÔ¡£Ö§³ÖÖÐÎÄ£¬Ö§³Ö°æ±¾±È½Ï¡¢È¨ÏÞ¹ÜÀíµÈ¹¦ÄÜ£¡
ÏîÄ¿Ö÷Ò³£º http://www.jspwiki.org/
ÎĵµµØÖ·£º  ......