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

Sun Sample exam: mistake??

 
Alfred Kemety
Ranch Hand
Posts: 279
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The question is:
What is the result?
A- x = 0
B- x = 1
C- x = 2
D- x = 3
E- x = 4
F- Compilation fails
The code is as follows: (note the private modifier of the main method)

The answer is:
Option E is the correct answer. The instance variable b is initialized to false, reset to false on line 8 and falls through to line 15, where x is set to 4.
If the main method was declared public then this answer should have been fine.. but since it's private, it will compile but will print "Main method not public."
Am I missing something???
 
Kathy Sierra
Cowgirl and Author
Rancher
Posts: 1589
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We made a mistake on that question! It was never legal to mark the main method private, but it used to actually compile and run under some flavors of 1.3 (fixed in 1.4). Anyway, that sample question is being fixed to make the main method public.
cheers
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kathy,
would you like to elaborate on that "we"?
Do you mean you're from "S...huuuush"?
-Barry
[ October 11, 2002: Message edited by: Barry Gaunt ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic