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

Javaµ÷ÓÃÍⲿ³ÌÐò

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
public class CmdTest {
    private static final long serialVersionUID = -2650474785662737262L;
    public static void main(String[] args) throws Exception {
        Runtime runtime = Runtime.getRuntime();
        Process p = runtime.exec("c:\\test.bat");
        DealStream errStream = new DealStream(p.getErrorStream(),"Err");
        DealStream outStream = new DealStream(p.getInputStream(),"Out");
        new Thread(errStream).start();
        new Thread(outStream).start();
        int exitValue = p.waitFor();
        System.out.println("exitValue -- > " + exitValue);
    }
}
class DealStream implements Runnable{
    private InputStream is;
    private String type;
    public DealStream(InputStream is,String type){
        this.is = is;
        this.type = type;
    }
    public void run(){
        try{
            InputStreamReader isr = new InputStreamReader(is);
            BufferedReader br = new BufferedReader(isr);
            String temp = null;
            while((temp = br.readLine()) != null){
                System.out.println(type + "-->" + temp


Ïà¹ØÎĵµ£º

ÈçºÎ½â¾öJava WEBÓ¦ÓÃÖеÄÂÒÂëÎÊÌâ


±¾×÷Æ·²ÉÓÃ֪ʶ¹²ÏíÊðÃû-·ÇÉÌÒµÐÔʹÓÃ-Ïàͬ·½Ê½¹²Ïí 2.5 Öйú´ó½Ðí¿ÉЭÒé½øÐÐÐí¿É¡£
µ±ÎÒÃÇͨ¹ýJava³ÌÐòÔ±µÄÊÓ½ÇÀ´ä¯ÀÀÍøÒ³Ê±»á·¢ÏÖ£ºÒ»·½ÃæÓû§¶Ëä¯ÀÀÆ÷£¨IE»òFirefox£©ÒÔ±íµ¥»òÁ´½ÓµÄ·½Ê½Ìá½»HTTPÇëÇóͬʱÓÖ´¦ÀíHTTP·þÎñÆ÷·¢³öµÄÏìÓ¦Êý¾Ý£¬½«ÆäÖеÄÊý¾ÝÁ÷£¨HTMLÊý¾Ý»òÆäËüÖÖÀàµÄÊý¾Ý£©ÒÔÊʵ±µÄ·½Ê½Õ¹Ê¾¸øÊ¹ÓÃÕßä¯ÀÀ¡ ......

java³£¿¼µÄ¼¸¸öÅÅÐò

1.дһ¸öðÅÝÅÅÐòµÄ³ÌÐò¡£
        public class Sort
{
         public static void main(String[] args)
         {
           &n ......

¼¸ÖÖ¶ÁÈ¡ÊôÐÔÎļþµÄJAVAʵÏÖ·½Ê½

 1.ʹÓÃjava.util.PropertiesÀàµÄload()·½·¨
¡¡¡¡
¡¡¡¡Ê¾Àý£º
Java´úÂë
InputStream in = lnew BufferedInputStream(new FileInputStream(name));   
¡¡¡¡Properties p = new Properties();   
¡¡¡¡p.load(in);  
InputStream ......

JAVAÅÅÐò»ã×Ü

package sort;

import java.util.Random;

/**
* ÅÅÐò²âÊÔÀà
*
* ÅÅÐòËã·¨µÄ·ÖÀàÈçÏ£º 1.²åÈëÅÅÐò£¨Ö±½Ó²åÈëÅÅÐò¡¢ÕÛ°ë²åÈëÅÅÐò¡¢Ï£¶ûÅÅÐò£©£» 2.½»»»ÅÅÐò£¨Ã°ÅÝÅÝÅÅÐò¡¢¿ìËÙÅÅÐò£©£»
* 3.Ñ¡ÔñÅÅÐò£¨Ö±½ÓÑ¡ÔñÅÅÐò¡¢¶ÑÅÅÐò£©£» 4.¹é²¢ÅÅÐò£» 5.»ùÊýÅÅÐò¡£
*
* ¹ØÓÚÅÅÐò·½·¨µÄÑ¡Ôñ ......

javaÊý¾ÝÀàÐÍת»»

1ÈçºÎ½«×Ö´® String ת»»³ÉÕûÊý int?
A. ÓÐÁ½¸ö·½·¨:
1). int i = Integer.parseInt([String]); »ò
i = Integer.parseInt([String],[int radix]);
2). int i = Integer.valueOf(my_str).intValue();
×¢: ×Ö´®×ª³É Double, Float, Long µÄ·½·¨´óͬСÒì.
2 ÈçºÎ½«ÕûÊý int ת»»³É×Ö´® String ?
A. ÓÐÈþÖÖ·½·¨:
1.) ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ