http://www.csdn.net/Expert/topic/419/419501.shtm
http://www.csdn.net/Expert/topic/403/403222.shtm 

解决方案 »

  1.   

    没有程序入口(public static void main(String[] args)).
    每一个可执行的java 类必须有它且只能有一个。可以修改为:public class Greeting {
        public void greet() {
          System.out.println("hi");
        }
        public static void main(String[] args){
             Greeting g=new Greeting();
     g.greet(); 
        }
      }
      

  2.   

    你的类没有主程序,当然不能运行了
    public class Greeting {
        public void greet() {
          System.out.println("hi");
        }
        public static void main(String[] args){
            Greeting myGreet=new Greeting();
            myGreet.greet();
          } 
      }
      

  3.   

    你main()函数没有啊,这跟c,c++一样的.