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
Ïà¹ØÎĵµ£º
±¾×÷Æ·²ÉÓÃ֪ʶ¹²ÏíÊðÃû-·ÇÉÌÒµÐÔʹÓÃ-Ïàͬ·½Ê½¹²Ïí 2.5 Öйú´ó½Ðí¿ÉÐÒé½øÐÐÐí¿É¡£
µ±ÎÒÃÇͨ¹ýJava³ÌÐòÔ±µÄÊÓ½ÇÀ´ä¯ÀÀÍøÒ³Ê±»á·¢ÏÖ£ºÒ»·½ÃæÓû§¶Ëä¯ÀÀÆ÷£¨IE»òFirefox£©ÒÔ±íµ¥»òÁ´½ÓµÄ·½Ê½Ìá½»HTTPÇëÇóͬʱÓÖ´¦ÀíHTTP·þÎñÆ÷·¢³öµÄÏìÓ¦Êý¾Ý£¬½«ÆäÖеÄÊý¾ÝÁ÷£¨HTMLÊý¾Ý»òÆäËüÖÖÀàµÄÊý¾Ý£©ÒÔÊʵ±µÄ·½Ê½Õ¹Ê¾¸øÊ¹ÓÃÕßä¯ÀÀ¡ ......
1.дһ¸öðÅÝÅÅÐòµÄ³ÌÐò¡£
public class Sort
{
public static void main(String[] args)
{
&n ......
1.ʹÓÃjava.util.PropertiesÀàµÄload()·½·¨
¡¡¡¡
¡¡¡¡Ê¾Àý£º
Java´úÂë
InputStream in = lnew BufferedInputStream(new FileInputStream(name));
¡¡¡¡Properties p = new Properties();
¡¡¡¡p.load(in);
InputStream ......
package sort;
import java.util.Random;
/**
* ÅÅÐò²âÊÔÀà
*
* ÅÅÐòËã·¨µÄ·ÖÀàÈçÏ£º 1.²åÈëÅÅÐò£¨Ö±½Ó²åÈëÅÅÐò¡¢ÕÛ°ë²åÈëÅÅÐò¡¢Ï£¶ûÅÅÐò£©£» 2.½»»»ÅÅÐò£¨Ã°ÅÝÅÝÅÅÐò¡¢¿ìËÙÅÅÐò£©£»
* 3.Ñ¡ÔñÅÅÐò£¨Ö±½ÓÑ¡ÔñÅÅÐò¡¢¶ÑÅÅÐò£©£» 4.¹é²¢ÅÅÐò£» 5.»ùÊýÅÅÐò¡£
*
* ¹ØÓÚÅÅÐò·½·¨µÄÑ¡Ôñ ......
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.) ......