Returns a formatted string using printf-style format.
Syntax
date.format(DateTimeFormatter.ofPattern(pattern))Example
Enter values below to update the example in real time.
String→name→result→System→out→println→String name = "Alice";
int age = 30;
String result = String.format("이름: %s, 나이: %d", name, age);
System.out.println(result); // "이름: Alice, 나이: 30"