using System;class test{
    public int max(int x,int y){
    if(x>y)
return x;
    else
return y;
}
public void Main(){
Console.WriteLine("the:",max(6,8));
}
}我在public void Main()这里加入了static,提示非静态方法或属性,初学!我是照书做的!

解决方案 »

  1.   

    你的Main加了static 那麽 裏面調用的 max方法也必須是 static .
      

  2.   

    1.未定义入口点:Main函数必须为static
    2.提示非静态方法或属性,同楼上,static方法只能调用static方法。
      

  3.   

    [STAThread]
    public static void Main(){
      

  4.   

    不用加[STAThread]也可以吧,
    [STAThread]是定义程序是单线程的
      

  5.   

    static void Main() 
    {
    Application.Run(new PlaySound());
    }
      

  6.   

    [STAThread]
    static void Main() 
    {
    Application.Run(new Form1());
    }
      

  7.   

    Main 必须用static 来建立入口.因为必须给定静态地址