Hi everyone
I need to hand in this assignment today :(
Im trying to read from a file and read it onto the screen, my code keeps showing up an error saying 'java.lang.NoSuchMethodError: Main'
Here is my code:
import java.io.*;
import java.awt.*;
import java.applet.*;
public class Empty_3 extends Applet {
TextArea ta = new TextArea();
public void init()
public static void main(String args[])
{
setLayout(new BorderLayout());
add(ta, BorderLayout.CENTER);
try {
InputStream in =
getClass().getResourceAsStream("test1.txt");
InputStreamReader isr =
new InputStreamReader(in);
BufferedReader br =
new BufferedReader(isr);
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
String line;
while ((line = br.readLine()) != null) {
pw.println(line);
}
ta.setText(sw.toString());
} catch (IOException io) {
ta.setText("Ooops");
}
}
}
Can anyone help me please?
Thankyou
Matt