public class test{
  public static void main(String arg[]){
     System.in.read();
  {
}什么包也不用。

解决方案 »

  1.   

    楼上的也可以,我也给一个import javax.swing.*;public class test{
    public static void main(String a[]){
    String s=JOptionPane.showInputDialog(null,"输入你要输入的","");
    System.out.print(s);
    }
    }
      

  2.   

    实际上是自动import了java.lang.*下的所有类---还是需要(自动)装载的。
      

  3.   

    建议看一下java的流概念。  in和out是System处理输入和输出的两个基本类。System.in和System.out两个类提供了相关处理方法。还是要多说一次,建议看流咯。
      

  4.   

    各位大侠:我的程序是:public class Class1
    {
      public static void main (String[] args)
    {
    // TODO: Add initialization code here
     System.in.read();
    }
    }可在解释运行期间出错:Exception 'IOException' not caught or declared by 'void Class.main(String[] ...目录名文件名)肯定是出在System.in.read()上,但不知道为什么出错。
    我的平台是Ms visual J++
      

  5.   

    我认为,这方面的东西用:String,BufferedInputStream,BufferedOutputStream,再加个Runtime,应该就可以了。我是这样做的,相关的都 可以,不一定要用我提到的这些类。
      

  6.   

    抄的,给你个思路
    /**
     * 读取一个txt文件
     * 最后的输出会使系统响铃一声
     * @author alin
     */
    import java.io.*;
    public class TestIO { public static void main(String[] args) { try {
    File file = new File("./testio.txt");
    //准备一个文件对象
    System.out.println(file.getPath().toString());
    //试一下获取路径
    BufferedReader bw = new BufferedReader(new FileReader(file));
    //用字符流读取文件(用缓冲流封装文件的数据流)
    String ss;
    String sb = "";
    while ((ss = bw.readLine()) != null) {
    //循环读取一行,在循环里,每运行一次realLine(),行指针下移一行
    System.out.println(ss);
    sb = sb + ss; //把从文件中读出的每行都添到sb里
    }
    bw.close();
    System.out.println(sb.toString());
    } catch (IOException e) {
    }
    char chrBell='\007'; System.out.println(chrBell);
    }
    }
      

  7.   

    你解决了没有啊,try{
       System.in.read();
    }
    catch(Exception e){
    }一定要加上异常捕获,否则会报错的。
      

  8.   

    解决了.
    Thanks for newman0708(nch) 为什么一定要加上异常捕获??
      

  9.   

    上面若干人给你解答了。为什么要异常捕获?
    不知道,但是为什么不?
     System.in.read() throws IOException;