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

ÊÕ²Ø java×·¼ÓдÎļþµÄ·½·¨

 import java.io.BufferedWriter;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.RandomAccessFile;
/**
 * ÃèÊö£º×·¼ÓÄÚÈݵ½Îļþĩβ
 * @author Administrator
 *
 */
public class WriteStreamAppend {
 /**
  * ×·¼ÓÎļþ£ºÊ¹ÓÃFileOutputStream£¬ÔÚ¹¹ÔìFileOutputStreamʱ£¬°ÑµÚ¶þ¸ö²ÎÊýÉèΪtrue
  *
  * @param fileName
  * @param content
  */
 public static void method1(String file, String conent) {
  BufferedWriter out = null;
  try {
   out = new BufferedWriter(new OutputStreamWriter(
     new FileOutputStream(file, true)));
   out.write(conent);
  } catch (Exception e) {
   e.printStackTrace();
  } finally {
   try {
    out.close();
   } catch (IOException e) {
    e.printStackTrace();
   }
  }
 }
 /**
  * ×·¼ÓÎļþ£ºÊ¹ÓÃFileWriter
  *
  * @param fileName
  * @param content
  */
 public static void method2(String fileName, String content) {
  try {
   // ´ò¿ªÒ»¸öдÎļþÆ÷£¬¹¹Ô캯ÊýÖеĵڶþ¸ö²ÎÊýtrue±íʾÒÔ×·¼ÓÐÎʽдÎļþ
   FileWriter writer = new FileWriter(fileName, true);
   writer.write(content);
   writer.close();
  } catch (IOException e) {
   e.printStackTrace();
  }
 }
 /**
  * ×·¼ÓÎļþ£ºÊ¹ÓÃRandomAccessFile
  *
  * @param fileName
  *            ÎļþÃû
  * @param content
  *            ×·¼ÓµÄÄÚÈÝ
  */
 public static void method3(String fileName, String content) {


Ïà¹ØÎĵµ£º

javaÈëÃÅ

 Javaѧϰ´ÓÈëÃŵ½¾«Í¨ 
Ò»¡¢ JDK (Java Development Kit) 
JDKÊÇÕû¸öJavaµÄºËÐÄ£¬°üÀ¨ÁËJavaÔËÐл·¾³£¨Java Runtime Envirnment£©£¬Ò»¶ÑJava¹¤¾ßºÍJava»ù´¡µÄÀà¿â(rt.jar)¡£²»ÂÛʲôJavaÓ¦Ó÷þÎñÆ÷ʵÖʶ¼ÊÇÄÚÖÃÁËij¸ö°æ±¾µÄJDK¡£Òò´ËÕÆÎÕJDKÊÇѧºÃJavaµÄµÚÒ»²½¡£×îÖ÷Á÷µÄJ ......

Java ÍøÂç³ÌÐò

 JavaÔÚÍøÂç±à³ÌÕâ¸öµØ·½×öµÄºÜºÃ£¬javaµÄÖ÷ҪĿµÄÒ²ÊÇΪÁËÍøÂç¶øÉúµÄ£¬ËüÄÜ·½±ãµÄ·ÃÎÊÍøÂçÉϵÄ×ÊÔ´¡£ÎÒÃÇÕâ½Ú¿ÎÀ´½éÉÜÍøÂçͨѶµÄÁ½ÖÖ»úÖÆ£ºURLͨÐÅ»úÖÆ£¬SocketͨÐÅ»úÖÆ¡£
URL±íʾÁËInternetÉÏÒ»¸ö×ÊÔ´µÄÒýÓûòµØÖ·¡£JavaÍøÂçÓ¦ÓóÌÐòÒ²ÊÇʹÓÃURLÀ´¶¨Î»Òª·ÃÎʵÄInternetµÄ×ÊÔ´¡£ÔÚjdkÀïÃæjava.net.URLÒ²ÊÇÒ»¸öÀ࣬Ëü ......

Java¶ÔÏó´®Ðл¯ÊµÀý

 1.StudentList.java:
/**
 *
 * @author lucifer
 */
package JavaSerializable;
import java.util.*;
import java.io.*;
public class StudentList implements Serializable{
     Vector list = new Vector(6);
     public StudentList(){} ......

java·´Éä³£¼û·½·¨

»ñÈ¡classÀà·½·¨£º
1£¬getClass 2£¬Class.forName() 3,ÓÃ.class
public Field[] getDeclaredFields()
·µ»ØµÄÊÇij¸öÀàÀïµÄËùÓÐÀàÐ͵ıäÁ¿£¬²»°üÀ¨¼Ì³Ð¸¸ÀàµÄ
public Field[] getDeclaredFields(String name)
·µ»ØÌض¨Ãû×Ö
public Field[]  getFields()
·µ»ØµÄÊÇij¸öÀàÀïµÄËùÓÐpublicÀàÐ͵ıäÁ¿£¬°üÀ¨¼Ì³Ð¸¸Àൠ......

java±ÊÊÔ»ã×Ü£¨2£©

41¡¢ÊÇ·ñ¿ÉÒԼ̳ÐStringÀà?
StringÀàÊÇfinalÀà¹Ê²»¿ÉÒԼ̳С£
42¡¢swtichÊÇ·ñÄÜ×÷ÓÃÔÚbyteÉÏ£¬ÊÇ·ñÄÜ×÷ÓÃÔÚlongÉÏ£¬ÊÇ·ñÄÜ×÷ÓÃÔÚStringÉÏ?
switch£¨expr1£©ÖУ¬expr1ÊÇÒ»¸öÕûÊý±í´ïʽ¡£Òò´Ë´«µÝ¸ø switch ºÍ case Óï¾äµÄ²ÎÊýÓ¦¸ÃÊÇ int¡¢ short¡¢ char »òÕß byte¡£long,st ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ