2 luhongminmin luhongminmin 于 2013.12.24 00:07 提问

out putStream出错,

<%@ page contentType="text/html" pageEncoding="GBK"%>
<%@ page import="java.io.*"%>




<%
File f=new File("d:"+File.separator+"apache-tomcat-

6.0.37/webapps/ROOT/test.txt");
OutputStream out=null;
out = new FileOutputStream(f) ;

    String str = "Hello World!!!" ;     
    byte b[] = str.getBytes() ;         
    out.write(b) ;                      

    out.close() ;                       
out.close();

%>


错误提示如下

An error occurred at line: 11 in the jsp file: /file.jsp
Duplicate local variable out
8: <%
9:
10: File f=new File("d:"+File.separator+"apache-tomcat-6.0.37/webapps/ROOT/test.txt");
11: OutputStream out=null;
12: out = new FileOutputStream(f) ;

13:

14: String str = "Hello World!!!" ;

An error occurred at line: 20 in the jsp file: /file.jsp
The method write(int) in the type OutputStream is not applicable for the arguments (String)
17:

18: out.close() ;

19: out.close();
20: %>
21:
22:

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!