Spring08-Pre-Quiz3-Questions
I copied the code from part IV of the Pre-Quiz in DrJava and in part c of question 2 and 3 where it says
raphael.toString();
leonardo.toString();
it does not show "A ninja turtle" in the interactions pane.
Are you sure the answers to the pre quiz are right?
- I'm sure. Look at the files provided on t-square in the Quiz 3 folder. Dawn Finney.
In the files you have :
System.out.println(leonardo.toString());
but in the prequiz it only says leonardo.toString();
- It's because the prequiz it says what will happen if you put the following code in the interactions pane. If you call a method that returns String and don't add a ; on the end in the interaction pane, it will print out the String that gets returned. However if you want to do something similar in a main, you need a System.out.println. Dawn Finney
In part VI, why the card Number is initialized at -1?
- Because you're supposed to initialize the variable. Dawn Finney.
Link to this Page