Static Error: This class does not have a static void main method accepting String[]

后端 未结 3 1441
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-12 07:29

I\'m learning, I\'m newbie but I wanted to know what I do to get \"run\" it. this happening a error:

Static Error: This class does not have a static void mai         


        
3条回答
  •  死守一世寂寞
    2020-12-12 08:20

    Alternate to @mellamokb Answer

    public class Caneirinho{
    
     public static void contar(){
       int i = 1;
       String a = " Carneirinho",
         b = " pulando a cerca.",
         c = "s";
    
       for(i=1; i<=100; i++){
         if(i==1){
           System.out.println( i + a + b );
          } else {     
            System.out.println( i + a + c + b ); 
            Thread.sleep(1000);  // thread wais for 1 sec ie 1000 milisecond    
          }     
        }
      }
    
    public static void main(String[] args){
       contar(); // call contar() from main method
    }
    
    }//Carneirinho
    

提交回复
热议问题