• Post Reply Bookmark Topic Watch Topic
  • New Topic

read file pullzed  RSS feed

eastjy eastjy
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
import java.io.*;
class ReadFile
public static void main(String args[]) throws Exception
//String ss="d:\\Temp\\Test.java";
//File readFile = new File(ss);
StringBuffer stfDir = new StringBuffer();
char ch = (char)System.in.read();
while( ch != '\n')
ch = (char)System.in.read();
String ss = stfDir.toString();
File readFile = new File( ss );
if( readFile.isFile() &&readFile.canWrite() && eadFile.canRead())
RandomAccessFile rafFile =
new RandomAccessFile(readFile,"rw");
System.out.println("File cannot be read!");
run input d:\temp\test.java(the file exists),the result is: File cannot be read!
but this file compile and run in JBuilder,the result is OK.
and I use the sentence which is commented,the result is right not only in JBuilder but JDK self.
another is the sentense list underside in java is not be allowed??
while(char ch = (char)System.in.read())!='\n')
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!