Every class in javaJava has the toString() method in it by default, which is called by System.out.println() if you pass some object of athat class to it. When you try to print object of a class, the System.out.println() method will. By default, this call toString() of the class which returns the className@hashcode of that object.
{ SomeClass sc = new SomeClass(); // Class @ followed by hashcode of object in Hexadecimal System.out.println(sc); } You can override the toString method of a class to get different output. See this example
class A { String s = "I am just a object"; @Override public String toString() { return s; } } class B { public static void main(String args[]) { A obj = new A(); System.out.println(obj); } }