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

Any Java class that you run directly must have a main method, which is the entry point, i.e., where the program starts when you execute the code.

public static void main(String args[])

Just rename your method contar() to main(String args[]) and it should work.

Leave a Comment