This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
I'm trying to learn Java from HeadFirst Java book by Kathy & Bert Chapter 9, page 255. I've struggle through all the previous chapter but manage to understand the concept.
But one thing that I'm stuck on is this code on page 255:
the code above is right, I understand it but when I played around with it and change the class name and it's constructor to Hippau like :
It still works!
I don't get it when I create the new object Hippo like:
Hippo h = new Hippo ("Buffy");
what class does the object Hippo refer to? I've just changed the class Hippo to Hippao.
I'm so confused.
Maybe I didn't get the concept of object oriented programming yet....
Thanks in Advance
Apparently, what you don't know can hurt you...
Timothy Onggowasito wrote:........ I didn't know the compiler creates a new class file anytime I change it's name ...
Compiler create one .class file for one concrete class. (irrespectible whether they all are written in single .java file). That's why you got class Hippo and Hippau. It is always advisable to do clean build after modification.