toString()
A method that returns a readable text representation of an object.
What does toString() do in Java?
toString() — A method that returns a readable text representation of an object.
record Product(String name) {
}
class ProductCheck {
boolean sameProduct(Product first, Product second) {
return first.equals(second);
}
}
Level: Journeyman · More Java terms at this level
Updated