Question: What is String.formatted() in Java 15?Answer:We could previously replace placeholders in a string as follows, for example: Starting from Java 15, we can use an alternative syntax: It makes no difference which method you use. Both methods will eventually call the following code: So the choice is ultimately a matter of taste. I quickly made friends with the new spelling. |
Сохранить для повторения
Добавьте этот элемент в закладки, отметьте как сложный или поместите в набор для повторения.
Войдите, чтобы сохранять закладки, сложные вопросы и наборы для повторения.
Самое полезное по оценкам пользователей:
- What is Java 15?
- What is Text Blocks or Multi-line string in Java 15?
- What are New String and CharSequence Methods in Java 15?
- What is CharSequence.isEmpty() in Java 15?
- Provide the release notes of Java 15.