0
[JAVA] Change where toString appears in console
I have two classes, one is a Customer class and stores attributes and a toString. The other, my main class, has an object for the customer and when invoked the toString appears as the last statement executed. I have another object which needs to go before the toString from the Customer class is called. How can I change where the toString appears? To invoke the object I am using: System.out.println(customerObject()):
1 Antwort
+ 1
I cant be sure what you mean without seeing the code, in java each class inherits the toString() method from class Object there might be a problem with how your overriding this method if your classes extend from one another.