Roel De Nijs wrote:So my first advice would definitely be: get rid of your IDE, only use your favourite text editor, javac and java. Other opinions about using an IDE while preparing for the OCA exam can be found here.
Campbell Ritchie wrote:If all those classes are top‑level classes, then the five public classes would be in files called PondDuck.java, FatherDuck.java, BadDuckling.java, MotherDuck, and GoodDuckling.java.
You are, I am afraid, incorrect about matching package names and class names. Also I recommend you forget the concept that there is such a thing as a main class, never mind how many people use that term.
Work out what the different name identifiers in the speak() method mean.
Jake Monhan wrote:Page 189 . . .
There is a difference between that line 6 and the previous code. When you work out the difference, you will probably understand the differences in behaviour.
. . .
6: letters = letters(letters); // abcd
. . .
What makes you think the class should be marked static? Do you remember what sort of classes can be marked static in the first place?
It has to do with pass‑by‑value. Remember Java® doesn't support pass‑by‑reference.
Jake Monhan wrote:As pages 189 and 191, Yup I get it. One is assigned and one is not.
What does that mean? How do you know I don't like something?
. . . I know you don't like the referral . . .
That sound incorrect. Try this sort of code:-See what happens.
since the class is main class, then it does not need static specifier.
What makes you think that? It is quite possible to create an instance of an inner class in a static context.
If it were a class within another class, then it would have needed the static specifier.
Two out of three aren't bad, but at that sort of ratio you are risking averaging 2.9 out of three, which will mean you have to go back and sit the exam again.
So how did I do?
Jake Monhan wrote:
Although the code on page 193 is about overloading, looking at the that code and your sample, I wonder if I missing fundamental concept of how a method with return of void vs. a method having return, is handled.
Jake Monhan wrote:I made the following modification to the code on page 205 and the result of all 4 print statement was -1. So how does the IF condition guards against negative numbers?
Yes, assuming there were no eggs before.
Jake Monhan wrote:. . . although the variable numberEggs = -1, the instance variable numberEggs is still zero. . . .
That isn't some sort of authorative reference; Joe Coder there is the only person I have seen say class overloading, so I suspect it is a phrase he uses himself. I do that myself; I have recently started thinking we should call the Equality Operator the “same object operator”.
Jake Monhan wrote:I was doing a Google search on inheritance in java and came across,