当前位置: 技术问答>java相关
为什么显示错误:Undefine name 's'
来源: 互联网 发布时间:2015-05-01
本文导语: import java.io.*; public class Runtime1 { /** * The main entry point for the application. * * @param args Array of parameters passed to the application * via the command line. */ public static void main (String[] args) { int i=0; ...
import java.io.*;
public class Runtime1
{
/**
* The main entry point for the application.
*
* @param args Array of parameters passed to the application
* via the command line.
*/
public static void main (String[] args)
{
int i=0;
try{
String s[]=new String[2];
s[0]="/windows/exit.com";
s[1]="test.txt";
Runtime R=Runtime.getRuntime();
Process p=R.exec(s);
InputStream in=p.getInputStream();
OutputStream out=p.getOutputStream();
InputStream err=p.getErrorStream();
int exitcode=0;
try{
exitcode=p.waitFor();
}
catch (InterruptedException e){
}
System.out.println("Please print!!!!!!");
\语句1:
System.out.println(s[0]+"exited withcode"+exitcode);
}catch(java.io.IOException e){}
System.out.println(s[0]+s[1]);
while(i++
public class Runtime1
{
/**
* The main entry point for the application.
*
* @param args Array of parameters passed to the application
* via the command line.
*/
public static void main (String[] args)
{
int i=0;
try{
String s[]=new String[2];
s[0]="/windows/exit.com";
s[1]="test.txt";
Runtime R=Runtime.getRuntime();
Process p=R.exec(s);
InputStream in=p.getInputStream();
OutputStream out=p.getOutputStream();
InputStream err=p.getErrorStream();
int exitcode=0;
try{
exitcode=p.waitFor();
}
catch (InterruptedException e){
}
System.out.println("Please print!!!!!!");
\语句1:
System.out.println(s[0]+"exited withcode"+exitcode);
}catch(java.io.IOException e){}
System.out.println(s[0]+s[1]);
while(i++