• Post Reply Bookmark Topic Watch Topic
  • New Topic

Error in Round Up (#332)  RSS feed

 
Jimi Svedenholm
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
There is an error in the question #332 in the Round Up. The system will not exit on System.exit(), infact the code won't compile because there is no System.exit() method with no parameters.
Regards
Jimi
 
Art Metzer
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Strictly speaking, Jimih, you are correct. However, in non-JVM settings, empty parentheses after an identifier merely specify that the identifier is a method (as opposed to a variable, class or label), and not necessarily that that method has no arguments.
For example, at one of Sun's very own Web sites ( http://java.sun.com/docs/books/tutorial/essential/system/securityIntro.html ), I found the following quote:

For example, the System.exit() method, which terminates the Java interpreter, uses the security manager's checkExit() method to approve the exit operation:

This slapdash application of rules may concern you, Jimih, but it's the way the industry writes, for better or worse. It's all about context. I suppose the Round-Up game could have phrased its question using System.exit( int status ), but why? Now if "System.exit()" is in a snippet of code without an argument, you've definitely got a valid beef.
Good luck,
Art
[This message has been edited by Art Metzer (edited May 21, 2001).]
 
Jimi Svedenholm
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ah, ok...
I guess I just assumed that line should have been looked upon as one line of code, taken from a java-file...
Thanks for the reply.
Regards
Jimi
[This message has been edited by jimih (edited May 21, 2001).]
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"jimih",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.
Thanks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!