In my college, I was taught Java using BlueJ and we were asked to write main()
in the following manner (no string array present as parameter):
public static void main()
{
//code
}
This works in BlueJ but it doesn't work in other IDEs like Eclipse (using right now).
All over the internet and books (except college texts), I find main()
declared as
public static void main(String[] args)
.
My doubts:
- When is the first way of declaring
main()
valid? - If the first declaration is wrong, why isn't BlueJ giving an error?
- Is BlueJ designed to handle this internally?
- What is the actual use of the string array parameter?