This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Whenever you call System.out.println(Object obj), it in turn calls obj.toString().
From the API Docs for Object#toString()
Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.
The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object.
What you are seeing, Book@4fe5e2c3 is nothing but the hexadecimal representation of the object hash code.
the method toString() in the above code returns String Representation of your object's hashcode which is a unique code for each object in java.
if you want to get the String value specified by you in the Constructor as title property of your book class you must override toString() method
from the Object's Class and write your code to print the title of your book like i mentioned below.
now the code
will print it's title("How cats work") on your console.