java BufferWriterºÍPrintWriterЧÂÊ
ΪʲôÎÒÓÃBufferWriter±È²»Óû¨·ÑµÄʱ¼ä»¹Òª¶à£¿
¶øÓÃBufferOutputStreamʱ±È²»ÓÃЧÂÊÒª¸ßÊ®¼¸±¶
ÊDz»ÊÇÎҵĴúÂëÓÐÎÊÌâ
Çë¸ßÊÖ¸ø¸ö½âÊÍ
Java code:
import java.io.*;
public class BufferChar
{
public static void main(String[] args)
{
try
{
//Using BufferedWriter
long start=System.currentTimeMillis();
FileWriter fw_out=new FileWriter("file1.txt");
//BufferedWriter bfw_out=new BufferedWriter(fw_out);
PrintWriter out=new PrintWriter(new BufferedWriter(fw_out));
for(int i=0;i<10000;i++)
out.println((int)(Math.random()*10));
out.close();
long stop=System.currentTimeMillis();
//Using PrintWriter
long start1=System.currentTimeMillis();
FileWriter fw_out1=new FileWriter("file2.txt");
PrintWriter out1=new PrintWriter(fw_out1);
for(int i=0;i<10000;i++)
out1.println((int)(Math.random()*10));
out1.close();
long stop1=System.currentTimeMillis();
System.out.println("Time passed(Using BufferedWriter):"+(stop-start));
System.out.println("Time passed(Using PrintWriter):"+(stop1-start1));
Ïà¹ØÎÊ´ð£º
ͨ¹ýjava³ÌÐò£¬ÏȱàÒëc³ÌÐò£¬Èç³öÏÖ´íÎó£¬ÌáʾC³ÌÐòÖеĴíÎ󣬱àÒë³É¹¦¾ÍÔËÐУ¬ÏÔʾCµÄÔËÐнá¹û£¬×îºÃ°ÑCµÄÔËÐÐʱ¼äºÍÄÚ´æµÈ¶¼ÏÔʾ³öÀ´
¸÷λ´ó¸ç´ó½ã°ï°ï棬СµÜ¸Ð¼¤²»¾¡£¡
ÓÃjavaµÄ½ø³ÌÀàÊÔÊÔ
ÎÒ¸øÄãת ......
ÏÖÔÚ»¹ÓкܶàÈ˸㲻¶®PHPºÍJAVA¿ª·¢µÄÐͬOAµ½µ×ÓÐʲô²»Í¬£¬¶Ô×Ô¼ºµ½µ×ÓÐʲôӰÏ죬ÒÔÖÁÓÚ×ö³öÁË´íÎóµÄÑ¡Ôñ¶øêݺ¦ÎÞÇî¡£±ÊÕ߸ù¾ÝÁ½ÖÖ¼¼ÊõµÄÌصãÖØÐÂÕûÀíÁËÒ»¸ö¶Ô±È£¬¸ø¹ØÐÄÐͬOA¼¼ÊõµÄ¶ÁÕß×ö¸ö²Î¿¼¡£
»ªÌ춯Á¦Ð ......
<%@page language="java" contentType="text/html;charset=gb2312" import="java.sql.*"%>
<jsp:useBean id="db" class="wang.connectDB"/>
< ......
ÏÖÔÚÓöµ½ÕâÑùÒ»¸öÎÊÌ⣺
ÔÚjava Öбàдswing³ÌÐò£¬ Ìí¼Ó°´Å¥jbServerStart£¬Ä¿µÄÊǵ±µã»÷jbServerStartʱ£¬³ÌÐò»á×Ô¶¯´´½¨Á½¸öÓëÆäËûÖÕ¶ËͨÐŵĶÔÏ󣬴úÂëÈçÏ£º
private Container createButtonPane ......
ÐÔ±ð£ºÅ®
ÄêÁ䣺´óѧ±ÏÒµËĸöÔÂÁË
javaˮƽ£º³õ¼¶
Ä¿Ç°Çé¿ö£ºÔÚÒ»¸öÈí¼þ¹«Ë¾ÊµÏ°£¬Ö÷Òª×öjava£¬ÊµÏ°Èô¸Éʱ¼äÁË£¬Ã»Óй¤×Ê£¬Ã»ÓÐתÕý¡£
¼øÓÚ¾¼ÃѹÁ¦ºÍʵϰʱ¼ä½Ï³¤ÁË£¨Ö®Ç°Ñ§µÄdominoºóתµÄ ......