// Returns a string representation of this clock, using the format HH:MM.
public String toString()
{
return String.format("%02d:%02d", hour, minute);
}
- output:
01:02
// Returns a string representation of this clock, using the format HH:MM.
public String toString()
{
return String.format("%02d:%02d", hour, minute);
}
01:02