toString( )

If we are trying to print the object, println method automatically called the toString method. toString( ) method is predefined method inside the Object class. Object class is the parent class of every class. toString( ) method returns String representation of hash code. packageName.className@hexaDecimalValueOfHashcode. Ex 1: OUTPUT: Print Sample Class Object1: SelfLearn.Sample@c2e1f26Print Sample Class Object2:Continue reading “toString( )”

Design a site like this with WordPress.com
Get started