First of all I would like to say a big thank you to the users here who took the time to answer my questions. I achieved a 95% pass rate and the help I received on this forum certainly contributed to my grade
Yes, that is a good explaination. So a is null but that doesn't matter, as it gets replaced by Animal. However using an instance variable instead of the class name produces warnings which I am seeing in Eclipse, but they don't matter either for the sake of the test.
Thanks. (I'll be back when I've read Chapter 2 :-) )
I've just started studying for SCJP having completed chapter 1. I managed to get through the self test apart from question 4 which I thought would not compile due to an error on line 9 Here is the code: -
The reason I thought it would not compile is that line 9 is doing a.Dog and a.Fish instead of Animal.DOG and Animal.FISH. I'm unclear as to what variable a holds as it is uninitialised. I've put the code into eclipse and it gives me warnings on line 9: -
Would someone be able to clarify what is going on here?