PrepZone Logo
PrepZone
Back to Java

Java · Easy

What is String.formatted() introduced in Java 15? How does it compare to String.format()?

JavaJava 17+Strings

Answer preview

String.formatted() (Java 15) is an instance method equivalent to String.format() — it formats the string using format specifiers and arguments.…