Answer:
->The above syntax is very strict if we perform any change we will get
exception saying NoSuchMethodError:main.
-> Even though the above syntax is very strict the following changes
are acceptable.
->1. The order of modifiers is not important i.e. instead of "public static"
we can write "static public" also.
->2. We can declare "String[]" in any acceptable form.
main(String[] args)
main(String []args)
main(String args[])
->3. Instead of 'args' we can take any valid java identifier.
->4. We can replace String[] with var arg parameter.
main(String[]args) ---> main(String...args)
->5. We can declare main() method with the following modifiers also.
final
sychronized
strictfp
class Test{
final static sychronized strictfp public void main(String... javainvent){
System.out.println("main method");
}
}
Output : main method