Forum : Error in output
Brief description  about Online courses   join in Online courses
View Anusha  D R 's Profile

Error in output

By Anusha D R
import java.io.*;

class FileOutput_Add {
public static void main(String args[]) {
try {
int a,b;
FileWriter FileOut = new FileWriter("OutPutFile.txt");
BufferedWriter Output = new BufferedWriter(FileOut);
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
a = (int) br.read();
b = (int) br.read();
int c = a b;
Output.write(c);
Output.close( );
}
catch (Exception e) {
System.err.println("Error: " e.getMessage());
}
}
}




this program is executing without any errors but the destination file where the addition of two numbers getting stored there i am getting an alphabets which is equivalent to the number....

Actually when i submit the program to discussion board ' ' operator is not getting copied...
Asked by Anusha D R | Oct 2, 2010 |  Reply now
Replies (2)
View anusha d-r 's Profile
hi Rintu..
thank u so much it is working..
Oct 4, 2010
View rintu m--a 's Profile
hai.. Anusha...
pls write the code
a = Integer.parseInt(br.readLine());
instead of the code a = (int) br.read();
Oct 4, 2010