file read write

/* Hi there is some problem in read and write file

i am not getting how to resolve it

7 errors after compilation

D:\surekha\java\day3>javac ReadWrite1.java

ReadWrite1.java:18: ')' expected

outs.write(ch);

^

ReadWrite1.java:17: not a statement

(

^

ReadWrite1.java:11: 'try' without 'catch' or 'finally'

try

^

ReadWrite1.java:21: illegal start of type

catch(IOException e)

^

ReadWrite1.java:35: <identifier> expected

}

^

ReadWrite1.java:37: 'class' or 'interface' expected

}

^

ReadWrite1.java:39: 'class' or 'interface' expected

^

7 errors

*/

import java.io.*;

class ReadWrite1

{

public static void main(String s[])

{

File in=new File("in2.txt");

File out=new File("out2.txt");

FileReader ins=null;

FileWriter outs = null;

try

{

ins=new FileReader(in);

outs=new FileWriter(out);

int ch;

while((ch=ins.read())!=-1)

(

outs.write(ch);

}

}

catch(IOException e)

{

System.out.println(" ");

}

finally

{

try

{

ins.close();

outs.close();

}

catch(IOException e)

{

}

}

}

}

[1354 byte] By [SurekhaTa] at [2007-11-27 11:53:10]
# 1

Crossposted and answered

http://forum.java.sun.com/thread.jspa?threadID=5199594

cotton.ma at 2007-7-29 18:48:45 > top of Java-index,Core,Core APIs...