Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Is main a keyword  RSS feed

 
Dale DeMott
Ranch Hand
Posts: 515
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was thinking of some odd questions that come up from time to time.. and one of the questions I was thinking of was "Is main considered a keyword". I'm thinking no. but others argue yes...
Your thoughts...
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The others are wrong. Main is not a keyword: JLS 3.9. Yes, it's a string with special status, when used as the name of a static public method with String[] arguments. But not all "special" things are keywords, and the JLS is clear here.
Note that the list omits "assert" which was added in JDK 1.4. Eventually Sun will get around to updating the JLS properly. Of course the new features in 1.5 will be more extensive, so we'll probably see an updated JLS sometime after 1.5 is finally out.
[ January 19, 2004: Message edited by: Jim Yingst ]
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is a little practical demonstration, a perfectly legal Java program:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!