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.
Your class extends Object and it was not necessary to write that. Also you didn't override toString() method in you class (ExpImpl1) and therefore toString() method from Object is called. When you implement your own toString() method (public String toString()) in your class (ExpImpl1) you will override Object toString() method and your implementation will be called when you call toString() on ExpImpl1.
When you use primitive data types such as int,float, double etc., in your System.out.println() statement the value of the data is printed. But when you use an object reference in the System.out.println() statement the object toString() method is called and output of the toString() method(String) is printed in the console. [ February 19, 2008: Message edited by: Arivazhagan Arutchelvam ]