请java高手帮我看看,为什么这个程序提示fs1,fs2可能没有初始化?
importjava.io.*;publicclassSequenceTest{publicstaticvoidmain(Stringargs[]){FileInputS...
import java.io.*;
public class SequenceTest {
public static void main(String args[]) {
FileInputStream fs1,fs2;
InputStreamReader is;
BufferedReader s2;
String s;
try{
try{
fs1=new FileInputStream("c:/a11.txt");
fs2=new FileInputStream("c:/a22.txt");
}catch(FileNotFoundException e){
System.out.println("File not found or access denied:"+e);
System.exit(-1);
}
SequenceInputStream s1=new SequenceInputStream(fs1,fs2);
is=new InputStreamReader(s1);
s2=new BufferedReader(is);
while((s=s2.readLine())!=null)
System.out.println(s);
}catch(IOException e){
System.out.println("error:"+e);
System.exit(-2);
}
}
} 展开
public class SequenceTest {
public static void main(String args[]) {
FileInputStream fs1,fs2;
InputStreamReader is;
BufferedReader s2;
String s;
try{
try{
fs1=new FileInputStream("c:/a11.txt");
fs2=new FileInputStream("c:/a22.txt");
}catch(FileNotFoundException e){
System.out.println("File not found or access denied:"+e);
System.exit(-1);
}
SequenceInputStream s1=new SequenceInputStream(fs1,fs2);
is=new InputStreamReader(s1);
s2=new BufferedReader(is);
while((s=s2.readLine())!=null)
System.out.println(s);
}catch(IOException e){
System.out.println("error:"+e);
System.exit(-2);
}
}
} 展开
2个回答
展开全部
报的哪个异常啊?
追问
C:\SequenceTest.java:25: 可能尚未初始化变量 fs1
SequenceInputStream s1=new SequenceInputStream(fs1,fs2);
^
C:\SequenceTest.java:25: 可能尚未初始化变量 fs2
SequenceInputStream s1=new SequenceInputStream(fs1,fs2);
^
2 错误
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询