CODSTA.MAIN
The 'main()' method must be "public", "static" and "void"
Description
This rule flags any `main()' method that is not "public", "static", and "void".
The `main()' method must be "public", "static", and "void", and it must accept a single argument of type String[].
Example
package CODSTA;
public class MAIN {
static void main(String[] args) {// main method is
//not a public.
System.out.println("hello");
}
}
Repair
Use following signature for a `main()' method.
public static void main(String[] args)
Reference
Arnold, Ken, and Gosling, James The Java Programming Language. 2d ed. Addison Wesley, 1997, pp.55-56.
|