你外面的public class frame{}是多余的。

解决方案 »

  1.   

    1_java.lang.NoSuchMethodError: main Exception in thread "main" 
    修改方法是让程序以public class Memo extends Frame类开头就可以了,去掉外面的public class  frame
    当然注意要去掉其对应的结束符号,当然文件名也要改为Memo.java2——"Memo.java": Warning #: 368 : method resize(int, int) in class java.awt.Component has been deprecated at line 10, column 21
    修改完第一个错误后,在编译,出现上述报错。意思是说resize这个方法已经过时,建议用其他方法替换。
    这里改成setSize(500, 500);3_其他做了些细微修改,比如在main前加了static总之改后程序如下(已经测试通过)import java.awt.*;
    import javax.swing.*;public class Memo extends JFrame{
      public String motd;
       public Memo(String s)
                    {
                        motd=s;
                        setSize(500, 500);
                    }
                    public Memo(){this("This is a Memo");}
                    public void paint(Graphics g){g.drawString(motd,15,15);g.drawString("Click anywhere to Exit",15,25);}
                    public void start(){show();}
                    public boolean mouseDown(Event e,int x,int y)
                    {
                            //reSources dispose(); //Quit the app. System.exit(0);
                            return false;
                    }
                public static void main(String[] args)
                {
                            System.out.println("Hello World!");
                            Memo m;
                            m = new Memo("ddd");
                            m.start();
                    }
            }