In your statement, you concatenate a String
with a House
object. Thus, it will call toString()
method of House
and substitute its result.
Since you have probably not override this method, it uses default toString()
method, which prints class name and object reference.
Simply override toString()
method in your House
class:
public class House {
// ...
@Override
public String toString() {
return "House: "; // Customize it!
}
// ...
}