General Java Help
Hey Ive been learning to use Java through videos and thankfully its going pretty good, just some things I dont understand listed below:
In the above statement can someone tel me what "%" and "%s" does,
public String toString()
return String.format("%d:%02d:%02d %s", ((hour==0||hour==12)?12:hour%12), min, sec,(hour<12? "AM": "PM"));
and this one can someone tell me what "%s\n" does,
public void saying()
System.out.printf("Your first GF was %s\n", getName());
This has just been playing on my head abit, tried google but that didnt help.
Thanks very much for your time and support
Read the API documentation for the Formatter class; that class formats Strings according to those % format specifiers and its used by other classes.
Oh ok, thank you ill look it up