0

Is there any way to join a string and another variable together, that is also a string, without using the "+" operator. Specifically one similar to this one that is done in C#.

string str = $"Hello {userName}. Today is {date}.";

If there is any way to achieve a similar or same outcome in Java please let me know.

1 Answers1

0

See https://docs.oracle.com/javase/7/docs/api/java/lang/String.html

String.format("Hello %s. Today is %s.", userName, date);

hashmap
  • 400
  • 1
  • 9