¶ÁÎļþ£¨java£©
ʹÓÃJava²Ù×÷Îı¾ÎļþµÄ·½·¨Ïê½â
ÕªÒª: ×î³õjavaÊDz»Ö§³Ö¶ÔÎı¾ÎļþµÄ´¦ÀíµÄ£¬ÎªÁËÃÖ²¹Õâ¸öȱº¶¶øÒýÈëÁËReaderºÍWriterÁ½¸öÀ࣬ÕâÁ½¸öÀ඼ÊdzéÏóÀ࣬WriterÖÐ write(char[] ch,int off,int
length)£¬flush()ºÍclose()·½·¨Îª³éÏó·½·¨£¬ReaderÖÐread(char[] ch,int off,int length)ºÍclose()·½·¨ÊdzéÏó·½·¨¡£×ÓÀàÓ¦¸Ã·Ö±ðʵÏÖËûÃÇ¡£ µ±ÎÒÃǶÁдÎı¾ÎļþµÄʱºò£¬²ÉÓÃReaderÊǷdz£·½±ãµÄ£¬±ÈÈçFileReader£¬InputStreamReaderºÍBufferedReader¡£ÆäÖÐ×îÖØÒªµÄÀàÊÇInputStreamReader£¬ËüÊÇ×Ö½Úת»»Îª×Ö·ûµÄÇÅÁº¡£Äã¿ÉÒÔÔÚ¹¹ÔìÆ÷ÖØÖ¸¶¨±àÂëµÄ·½Ê½£¬Èç¹û²»Ö¸¶¨µÄ»°½«²ÉÓõײã²Ù×÷ϵͳµÄĬÈϱàÂ뷽ʽ£¬ÀýÈçGBKµÈ¡£µ±Ê¹ÓÃFileReader¶ÁÈ¡ÎļþµÄʱºò¡£FileReader fr = new FileReader("ming.txt");
int ch = 0;
while((ch = fr.read())!=-1 )
{
System.out.print((char)ch);
}
ÆäÖÐread()·½·¨·µ»ØµÄÊǶÁÈ¡µÃϸö×Ö·û¡£µ±È»ÄãÒ²¿ÉÒÔʹÓÃread(char[] ch,int off,int length)ÕâºÍ´¦Àí¶þ½øÖÆÎļþµÄʱºòÀàËÆ£¬²»¶à˵ÁË¡£Èç¹ûʹÓÃInputStreamReaderÀ´¶ÁÈ¡ÎļþµÄʱºòwhile((ch = isr.read())!=-1)
{
System.out.print((char)ch);
}
ÕâºÍFileReader²¢Ã»ÓÐʲôÇø±ð£¬ÊÂʵÉÏÔÚFileReaderÖеķ½·¨¶¼ÊÇ´ÓInputStreamReaderÖм̳йýÀ´µÄ¡£read()·½·¨ÊDZȽϺ÷Ñʱ¼äµÄ£¬Èç¹ûΪÁËÌá¸ßЧÂÊÎÒÃÇ¿ÉÒÔʹÓÃBufferedReader¶ÔReader½øÐаü×°£¬ÕâÑù¿ÉÒÔÌá¸ß¶ÁÈ¡µÃËٶȣ¬ÎÒÃÇ¿ÉÒÔÒ»ÐÐÒ»ÐеĶÁÈ¡Îı¾£¬Ê¹ÓÃreadLine()·½·¨¡£BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream("ming.txt")));
String data = null;
while((data = br.readLine())!=null)
{
System.out.println(data);
}
µ±ÄãÃ÷°×ÁËÈçºÎÓÃReaderÀ´¶ÁÈ¡Îı¾ÎļþµÄʱºòÄÇôÓÃWriterдÎļþͬÑù·Ç³£¼òµ¥¡£ÓÐÒ»µãÐèҪעÒ⣬µ±ÄãдÎļþµÄʱºò£¬ÎªÁËÌá¸ßЧÂÊ£¬Ð´ÈëµÄÊý¾Ý»áÏÈ·ÅÈ뻺³åÇø£¬È»ºóдÈëÎļþ¡£Òò´ËÓÐʱºòÄãÐèÒªÖ÷¶¯µ÷ÓÃflush()·½·¨¡£ÓëÉÏÃæ¶ÔÓ¦µÄдÎļþµÄ·½·¨Îª£º
FileWriter fw = new FileWriter("hello.txt");
String s = "hello world";
fw.write(s,0,s.length());
fw.flush();OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream("hello2.txt"));
osw.write(s,0,s.length());
osw.flush();PrintWriter pw = new PrintWriter(new OutputStreamWriter(new FileOutputStream("hello3.txt")),true);
pw.println(s);
²»ÒªÍü¼ÇÓÃÍêºó¹Ø±ÕÁ
Ïà¹ØÎĵµ£º
Debug͸ÊÓͼ
http://www.cnblogs.com/Jamesliang/archive/2010/01/09/1643188.html
µ±µã»÷Debug°´Å¥Ê±£¬Eclipse»áÌáʾÄã½øÈë Debug͸ÊÓͼ¡£¿ÉÒÔÔÚÓÒÉÏ·½Expressions´°¿Úµã»÷Êó±êÓÒ¼üÔÚµ¯³ö²Ëµ¥ÖÐÑ¡Ôñ Add Watch Expression »òÕßµã»÷ÈçÏÂͼËùʾ°´Å¥Ôò»á³öÏÖ£¬Ìí¼Ó±í´ïʽ´°¿Ú¡£Äã¿ÉÒÔÊäÈëÄã ......
1. Ñ»·listÖеÄËùÓÐÔªËØÈ»ºóɾ³ýÖظ´
public static List removeDuplicate(List list) {
for ( int i = 0 ; i < list.size() - 1 ; i ++ ) {
for ( int j = list.size() - 1 ; j > i; j -- ) {
if (list.get(j).equals(list.get(i))) {
......
½ñÌìÊÇ
3g
ÊÖ»ú¿ª·¢
Android
µÄµÚÒ»Ì죬ÊÇÀèÀÏʦ½²µÄ£¬ÀèÀÏʦÖ÷Òª½éÉÜÁË
3g
£¬ÒÔ¼°
Android
ºÍ¿ª·¢
Helloworld
³ÌÐò¡£
3g
ÊÇʲô
£º
3G
£¬È«³ÆΪ
3rd Generation
£¬ÖÐÎĺ¬Òå¾ÍÊÇÖ¸µÚÈý´úÊý×ÖͨÐÅ¡£
Ëùν
3G
£¬ÊÇÖ¸½«ÎÞÏßͨÐÅÓë¹ú¼Ê»¥ÁªÍøµÈ¶àýÌåͨÐŽá ......
½ñÌìÊÇѧϰAndroid¿ª·¢µÄµÚ¶þÌ죺
½ñÌìÖ÷ҪѧϰÁËÎļþµÄ¶ÁÈ¡¡¢ÒÔ¼°¶ÔxmlÎļþµÄ½âÎö£º
ʹÓÃÎļþ½øÐÐÊý¾Ý´æ´¢£º
ActivityÌṩÁËopenFileOutput()·½·¨¿ÉÒÔÓÃÓÚ°ÑÊý¾ÝÊä³öµ½ÎļþÖУ¬¾ßÌåµÄʵÏÖ¹ý³ÌÓëÔÚJ2SE»·¾³Öб£´æÊý¾Ýµ½ÎļþÖÐÊÇÒ»ÑùµÄ¡£
public class FileActivity extends Acti ......
½ñÌìÊÇѧϰ
Android
µÄµÚÈýÌ죬½ñÌìÖ÷ҪѧÁË
Android
ÄÚÖõÄ
SQLite
Êý¾Ý¿â£¬Ñ§Ï°ÁËÔöɾ¸Ä²é¡£
SharedPreferences
½øÐÐÊý¾Ý´æ´¢
:
Android
ƽ̨¸øÎÒÃÇÌṩÁËÒ»¸ö
SharedPreferences
À࣬ËüÊÇÒ»¸öÇáÁ¿¼¶µÄ´æ´¢À࣬ÌرðÊÊ ......