Does Java 8 support interpolation

11,614

Java8 has nothing to do with this. For formatted console output, you can use printf() or the format() method of System.out Try this out.

System.out.printf("My name is: %s%n", "Tom");
Share:
11,614
Dan Smith
Author by

Dan Smith

Updated on July 07, 2022

Comments

  • Dan Smith
    Dan Smith almost 2 years

    Groovy supports string interpolation operations. Here is an example

    def name = "Tom"
    println("Hello my name is ${name}")
    

    Does Java 8 support string interpolation as the way Groovy does?

    Any answer, greatly appreciated. Thanks

  • sh4d0w
    sh4d0w almost 6 years
    So basically, no
  • Milan Velebit
    Milan Velebit over 5 years
    @sh4d0w Should be the accepted answer really lol