Results 1 to 3 of 3
Thread: General Java Help
- 11-07-2010, 03:47 PM #1
Member
- Join Date
- Nov 2010
- Posts
- 4
- Rep Power
- 0
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,Java Code: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,Java Code: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
- 11-07-2010, 03:52 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,405
- Blog Entries
- 7
- Rep Power
- 17
Read the API documentation for the Formatter class; that class formats Strings according to those % format specifiers and its used by other classes.
kind regards,
Jos
- 11-07-2010, 03:57 PM #3
Member
- Join Date
- Nov 2010
- Posts
- 4
- Rep Power
- 0
Similar Threads
-
general help.
By socboy6579 in forum New To JavaReplies: 1Last Post: 10-24-2010, 10:41 PM -
general help.
By socboy6579 in forum New To JavaReplies: 1Last Post: 10-24-2010, 09:20 PM -
General Question about Java
By bayan in forum New To JavaReplies: 6Last Post: 05-26-2010, 11:16 AM -
general advice needed
By mac in forum New To JavaReplies: 1Last Post: 03-18-2010, 03:25 PM -
general confused about java question (easy!)
By sweetjava in forum New To JavaReplies: 1Last Post: 08-09-2009, 02:03 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks