Hi all, I wonder if you can help me to understand this. I came across the following code:
@Override
public String toString()
{
return String.format( "hourly employee: %s\n%s: $%,.2f; %s: %,.2f",
super.toString(), "hourly wage", getWage(),
"hours worked", getHours() );
} // end method toString
I have some problems with the various colons and semicolons inside the String.format
method, here return String.format( "hourly employee: %s\n%s: $%,.2f; %s: %,.2f"
. What are they? I dont' think they are flags or format specifiers are they? Are they just literals?
I have done a bit of reading about the subject but I haven't found that much on the book I am reading, so I thought I'd ask. Now, the semicolons and colons get printed, but is there a general rule as to what they are, how they work and where they go?
thanks