Code appears correct to me but the emulator isn't showing any result.
My application requires me to read the file line by line.
can sb help me out.
thanks in advance.
here's the code :
Using java Syntax Highlighting
- try{
- FileReader fin = new FileReader( "C:\\graph1.txt" );
- BufferedReader graphFile = new BufferedReader( fin );
- String line;
- tv.setText("reading file ...\n");
- while( ( line = graphFile.readLine( ) ) != null ){
- tv.append(line);
- StringTokenizer st = new StringTokenizer( line );
- try{
- String source = st.nextToken( );
- String dest = st.nextToken( );
- int cost = Integer.parseInt( st.nextToken( ) );
- g.addEdge( source, dest, cost );
- }
- catch( NumberFormatException e )
- { }
- }
- }
- catch( IOException e ) { }
Parsed in 0.033 seconds, using GeSHi 1.0.8.4





