Manish Manoj wrote:Hi Friends,
Today,I cleared OCJP-1.6 with 100%.
Thanks to Keithey Siera and Bert Bates.....
Dhaval Vithalani wrote:
Sha Zay Rain wrote:Dear All,
I am doing a very simple IO Stream program from Sun Java Tutorial Website. All of the codes go fine but the problem is got a File not found Exception. I have no idea about that. By the way, I am using Indigo Eclipse in Mac OS as may be this can also be the problem. The following is your reference. Please kindly see my codes and give me some valuable suggestions. Thanks and Regards.
Sha Zay
package basicIO;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class CopyBytes {
public static void main(String[] args) throws IOException {
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream("xanadu.txt");
out = new FileOutputStream("outagain.txt");
int c;
while ((c = in.read()) != -1) {
out.write(c);
}
} catch (Exception e) {
e.printStackTrace();
System.out.println("File Cannot be found!!!");
} finally {
if (in != null) {
in.close();
}
if (out != null) {
out.close();
}
}
}
}
i don't think so their is any problem in your code but still am put some file example for you.. refer that if.. i hope it is helpful to u...
Sha Zay Rain wrote:Dear All,
I am doing a very simple IO Stream program from Sun Java Tutorial Website. All of the codes go fine but the problem is got a File not found Exception. I have no idea about that. By the way, I am using Indigo Eclipse in Mac OS as may be this can also be the problem. The following is your reference. Please kindly see my codes and give me some valuable suggestions. Thanks and Regards.
Sha Zay
package basicIO;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class CopyBytes {
public static void main(String[] args) throws IOException {
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream("xanadu.txt");
out = new FileOutputStream("outagain.txt");
int c;
while ((c = in.read()) != -1) {
out.write(c);
}
} catch (Exception e) {
e.printStackTrace();
System.out.println("File Cannot be found!!!");
} finally {
if (in != null) {
in.close();
}
if (out != null) {
out.close();
}
}
}
}
Jelle Klap wrote:Well, not me, no. I doubt anyone else here has that kind of time, unfortunately, which is why we are NotACodeMill.
The links I put in my first reply do include code samples, both in the tutorial text and as links to complete .java files.