home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Java by Example
/
jbecd.bin
/
JBE-CD
/
NTUsers
/
JBECODE.ZIP
/
JavaByExample
/
chap36
/
FileApp.java
< prev
next >
Wrap
Text File
|
1996-03-25
|
909b
|
39 lines
import java.io.*;
public class FileApp
{
public static void main(String args[])
{
System.out.println("");
System.out.println("------------------------------");
System.out.println("");
try
{
FileInputStream inputStream =
new FileInputStream("test.java");
String str = "";
int b = 0;
while(b != -1)
{
b = inputStream.read();
str += (char)b;
}
inputStream.close();
System.out.println(str);
}
catch (FileNotFoundException e)
{
System.out.println("File not found!");
}
catch (IOException e)
{
System.out.println("I/O Error!");
}
System.out.println("------------------------------");
}
}