How do I make a class instance and then export it to a file? Hope you can help. Here is my code:
import java.io.*;
public class Testing {
public static void main(String[] args) {
// TODO Auto-generated method stub
Testing t = new Testing();
String fileName = ("C:/Users/Brandon/Desktop/Java/copy.java");
try {
FileWriter fileWriter =
new FileWriter(fileName);
BufferedWriter bufferedWriter =
new BufferedWriter(fileWriter);
bufferedWriter.write(t);
bufferedWriter.close();
}
catch(IOException ex) {
System.out.println(
"Error writing to file '"
+ fileName + "'");
I get this error message:
The method write(int) in the type BufferedWriter is not applicable for the arguments (Testing).
How do I fix this?