java ioÕýÈ·¶ÁÈ¡
дÈë
public static void Writer(String value) {
try{
File file2 = new File("F:\\countDB.txt");
if(!file2.exists()){
file2.createNewFile();
}
FileOutputStream writer = new FileOutputStream(file2,true);
OutputStreamWriter rp = new OutputStreamWriter(writer,"GBK");
BufferedWriter tmpBR = new BufferedWriter(rp,1024*1024);
tmpBR.write(value+"\r\n");
tmpBR.flush();
tmpBR.close();
rp.flush();
rp.close();
writer.flush();
writer.close();
}catch(Exception ex){
//ex.fillInStackTrace();
}
}
²éѯ
File file = new File("E:\\DB.txt");
FileInputStream read = new FileInputStream(file);
InputStreamReader rp = new InputStreamReader(read,"GBK");
BufferedReader tmpBR = new BufferedReader(rp,1024*1024);
String tmpLine = tmpBR.readLine();
while (tmpLine != null) {
&n
Ïà¹ØÎĵµ£º
ºÜ¶àÈËÔÚ³õѧJavaµÄʱºò¾³£»á±»ÊéÖнéÉܵÄÒ»¶Ñ»·¾³±äÁ¿µÄÉèÖøãµÃÍ·»èÄÔÕÍ£¬ºÜ¶àÊéÖж¼»áÔÚ³õ×°JDKµÄʱºòÈÃËû´ó¼ÒÉèÖÃJAVA_HOME»·¾³±ä
Á¿£¬ÔÚ¿ª·¢³ÌÐòµÄʱºòÉèÖÃCLASSPATH»·¾³±äÁ¿£¬¶øºÜ¶àÈ˲¢²»Àí½âÕâÁ½¸ö»·¾³±äÁ¿µÄ×÷Óã¬ÎÒÃÇÀ´·Ö±ð½øÐÐÏêϸµÄ²ûÊö¡£
Ê×ÏÈÊÇJAVA_HOME»·¾³±äÁ¿£¬ÎÒÃÇÏÈÀ´ ......
Java±à³ÌÄÇЩʶù84——IO¼ò½é
I/O´¦Àí¼¼ÊõÊÇJavaÓïÑÔÖÐʵÏÖÎļþ²Ù×÷¡¢ÄÚ´æ²Ù×÷¡¢¿ØÖÆ̨ÊäÈëÒÔ¼°ÍøÂç±à³ÌµÄ»ù´¡£¬µ«ÊÇÓÉÓÚI/O¼¼Êõ±¾ÉíµÄÉè¼ÆÔÒò£¬Ò²Ê¹µÃI/O´¦Àí¼¼ÊõµÄÄѶȱȽϴó£¬ÐèÒª»¨·Ñ±È½Ï´óµÄ¾«Á¦½øÐÐѧϰ¡£
11.1 I/O¼ò½é
ÔÚ³ÌÐòÖУ¬ÊäÈëºÍÊä³ö¶¼ÊÇÏà¶ÔÓÚµ±Ç°³ÌÐò¶øÑԵģ¬ÀýÈç´ÓÓ²ÅÌÉ϶ÁÈ¡Ò»¸öÅä ......
StringBuffer s = “abc”; //¸³ÖµÀàÐͲ»Æ¥Åä
StringBuffer s = (StringBuffer)”abc”; //²»´æÔڼ̳йØϵ£¬ÎÞ·¨½øÐÐǿת
StringBuffer¶ ......
Ò»¡¢static
ÇëÏÈ¿´ÏÂÃæÕâ¶Î³ÌÐò£º
public class Hello{
public static void main(String[] args){//(1)
System.out.println("Hello,world!");//(2)
}
}
¿´¹ýÕâ¶Î³ÌÐò£¬¶ÔÓÚ´ó¶àÊýѧ¹ýJava µÄ´ÓÀ´Ëµ£¬¶¼²»Ä°Éú¡£¼´Ê¹Ã»ÓÐѧ¹ýJava£¬¶øѧ¹ýÆäËüµÄ¸ß¼¶ÓïÑÔ£¬ÀýÈçC£¬ÄÇÄúÒ²Ó¦¸ÃÄÜ¿´¶®Õâ¶Î´úÂëµÄÒâ˼¡£ËüÖ»ÊǼòµ ......
¡¡¡¡Ëùν¶ÔÏóÐòÁл¯¾ÍÊǽ«¶ÔÏóµÄ״̬ת»»³É×Ö½ÚÁ÷£¬ÒÔºó¿ÉÒÔͨ¹ýÕâЩֵÔÙÉú³ÉÏàͬ״̬µÄ¶ÔÏó¡£Õâ¸ö¹ý³ÌÒ²¿ÉÒÔͨ¹ýÍøÂçʵÏÖ£¬¿ÉÒÔÏÈÔÚWindows»úÆ÷ÉÏ´´½¨Ò»¸ö¶ÔÏ󣬶ÔÆäÐòÁл¯£¬È»ºóͨ¹ýÍøÂç·¢¸øһ̨Unix»úÆ÷£¬È»ºóÔÚÄÇÀï׼ȷÎÞÎóµØÖØГװÅ䔡£ÊDz»ÊǺÜÉñÆæ¡£
¡¡¡¡Ò²ÐíÄã»á˵£¬Ö»Á˽âÒ»µãµã£¬µ«´ÓÀ´Ã»ÓнӴ¥¹ý£ ......