Win a copy of Mesos in Action this week in the Cloud/Virtualizaton 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