Print format | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Print format

import java.util.*; public class Program { public static void main(String[] args) { Date goodmorning = new Date(); System.out.format("Today is %tA, the %td of %tB. It's %tr", goodmorning , goodmorning , goodmorning , goodmorning ); } } When we put " Today is %tA, the %td of %tB. It's %tr" what is this form? Can we use different form? Any rules for these format? Thanksssssssss

13th Feb 2017, 7:38 AM
luanthai
1 Answer
0
More info on use with System.out.format(): https://docs.oracle.com/javase/tutorial/essential/io/formatting.html More info on conversion characters: https://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html Scroll down the pages a bit.
13th Feb 2017, 8:08 AM
ChaoticDawg
ChaoticDawg - avatar