This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Signature of main() method

 
Thomas Markl
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
class Test20 {
final static void public main(String args[] {} // ERROR!
// final static public void main(String args[]){ } // OK
}
Why this error?
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because before the method name there must stand the return type which is in this case void.
 
Peter Kristensson
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
final static void public main(String args[] {} // ERROR
you forgot the closing right parenthesis.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic