This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ambiguity

 
Fran Kindred
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did 2 mocks one of them from the whizlabs.

I get confused sometime when it asks me what the output is when it seems ambiguious.

I think the question was like nested if statements.

So as I was tracing along I realized there is no main program or even a class. Do I assume that this is already done and they omitted it out or should I say cannot compile because there is no main method.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can certainly compile a class without a main method, so don't choose that.
If you do not understand a mock question, then compile it yourself. If it compiles, then run it, writing your own main method to create instances of the class if necessary. You can also use a free learning IDE called BlueJ which allows you to create instances without main method if you want.

A secret: I use BlueJ all the time when helping people on this forum: try, see, learn.
[ December 15, 2004: Message edited by: Barry Gaunt ]
 
Fran Kindred
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but the question itself did not have a class. I'm aware that a class can contain without a main but in the question it had only the declaration of variables and nested if statemetns.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then put them in a static method in a class.
[ December 15, 2004: Message edited by: Barry Gaunt ]
 
Fran Kindred
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm still confused Barry.

If the question on the exam seemed like it would compile and run if placed in a main method should I assume this. Or do I say it wont compile, because there is no class declaration.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic