是不是仅仅是一个名为sourcesum的字符串?不生成文件?

解决方案 »

  1.   

    public FileOutputStream(String name) throws FileNotFoundException
    这是FileOutputStream的一个构造方法,name代表文件的名字,不是目录,如果系统发现这个name代表一个目录名而不是文件名,或者文件不存在但也不能被新建又或者文件存在但不能被打开等原因,就会抛FileNotFoundException(如果不存在该文件,系统会尝试新建的)
      

  2.   

    那文件的类型是什么?TXT?java?
      

  3.   

    类型自己定,如
    FileOutputStream out=new FileOutputStream("sourcesum.txt")
      

  4.   

    如果不指定,系统有一个默认的,我忘记了,好象是.dat一类的,你试试就知道了
      

  5.   

    是一般的文本文件或者是二进制文件
    不存在格式问题,如果是文本文件的话,可以用记事本来打开看看
    如果是二进制文件的话可以用Ultraedit来看看
      

  6.   

    创建输出文件
    FileOutputStream out=new FileOutputStream(new File("out.txt"));
      

  7.   

    FileOutputStream
    public FileOutputStream(String name)
                     throws FileNotFoundExceptionCreates an output file stream to write to the file with the specified name. A new FileDescriptor object is created to represent this file connection. 
    First, if there is a security manager, its checkWrite method is called with name as its argument. If the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason then a FileNotFoundException is thrown. 
    Parameters:
    name - the system-dependent filename 
    Throws: 
    FileNotFoundException - if the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason 
    SecurityException - if a security manager exists and its checkWrite method denies write access to the file.
    See Also:
    SecurityManager.checkWrite(java.lang.String)
      

  8.   

    我试了!的确是文本文件,可以用NOTEPAD打开。