IOException error


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: IOException error

  1. #1
    Join Date
    Oct 2003
    Posts
    1

    Unhappy IOException error

    Please help,

    i am new in java and i am trying to make a program that compares two string that it reads from two different files. if two letters are equal it increments the counter and writes the the total counter in another file. i dont know why it doesnt work. please any suggestions???
    Code:
    import java.io.*;
    
    
    class Temp1{
    
    public static void main(String[] args) {
    try{
    check_Strings();
    }catch(IOException ex){}
    }
    
    
    
     static void check_Strings() throws IOException
    {
    
    try{
         FileWriter file = new FileWriter("/Teza/Perfundimi.txt");
         PrintWriter fund = new PrintWriter(file);
    
         FileReader file1 = new FileReader("/Teza/temp.tmp");
         FileReader file2 = new FileReader("/Teza/Teza1/Result.rst");
    
         BufferedReader inputfile1 = new BufferedReader(file1);
         BufferedReader inputfile2 = new BufferedReader(file2);
    
         String one;
         String two;
    
         one = inputfile1.readLine().toString();
         two = inputfile2.readLine().toString();
    
         int counter = 0;
         int n = one.length();
         int i;
    
         for (i = 0; i <= n - 1; i++) {
           if (one.charAt(i) == (two.charAt(i)))
             counter++;
    
         }
    
    
         fund.print(counter);
          fund.close();
    inputfile1.close();
    inputfile2.close();
    }catch(IOException e)
    {}
    
      }
    
    
    }
    [ArchAngel added CODE tags]

  2. #2
    Join Date
    Mar 2003
    Posts
    834
    It's much more helpful if you post the full error message you're getting.
    ArchAngel.
    O:-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center