| | |
Reading in a file.
![]() |
Ive been given this code as part of a lexical analyser for which i will be coding a syntax analyser - however the file the lexical analyser will be reading will come throught this code:
public static void main(String[] args) throws IOException
{
BufferedReader din = new BufferedReader(new InputStreamReader(System.in)) ;
System.err.print("file? ") ;
System.err.flush() ;
String fileName = din.readLine().trim() ;
LexicalAnalyser lex = new LexicalAnalyser(fileName) ;
} // end of class LexicalAnalyser
The thing is - where is the path name meant to go? It works by replacing fileName however im not so sure why my lecturer has coded the bufferedreader and inputstreamreader
public static void main(String[] args) throws IOException
{
BufferedReader din = new BufferedReader(new InputStreamReader(System.in)) ;
System.err.print("file? ") ;
System.err.flush() ;
String fileName = din.readLine().trim() ;
LexicalAnalyser lex = new LexicalAnalyser(fileName) ;
} // end of class LexicalAnalyser
The thing is - where is the path name meant to go? It works by replacing fileName however im not so sure why my lecturer has coded the bufferedreader and inputstreamreader
![]() |
Similar Threads
- Reading from file, passing into function. (C)
- Help on a reading from a file programming (Java)
- Need help reading a file (C++)
- Reading a file into a Parallel Array (C++)
- problems with reading in file (C++)
- First year assigment on reading file, sorting and outputting invoice (C++)
- Error Message Concerning Reading File From A Drive (C++)
- reading a file into code (Java)
Other Threads in the Java Forum
- Previous Thread: missing return statement 106 and 123, any ideas??
- Next Thread: How to invoke array varibles to another main method
| Thread Tools | Search this Thread |
android api applet application apps array arrays automation awt bidirectional binary birt bluetooth businessintelligence busy_handler(null) card chat class classes client code collision columns component constructor crashcourse database designadrawingapplicationusingjavajslider draw eclipse error errors eventlistener exception expand fractal game givemetehcodez graphics gui guidancer html ide image inetaddress integer intellij j2me java javadoc javafx javamicroeditionuseofmotionsensor javaprojects jme jni jpanel jtree julia linux list loop machine map method methods mobile mobiledevelopmentcreatejar myaggfun netbeans newbie oracle plazmic print problem program programming project radio recursion scanner server set sharepoint smart sms smsspam sort sortedmaps sql string subclass support swing textfield threads tree unlimited utility webservices windows






