What is the Java equivalent to printing values in C#?

c#, java, printing

Solution

You can call `String.format` explicitly:

System.out.println(String.format(
    "My Integer equals %d, and the other one equals %d", myInt, myInt2));

Problem

In C#, I can say: ``` int myInt = 10; int myInt2 = 20; Console.WriteLine("My Integer equals {0}, and the other one equals {1}", myInt, myInt2); ``` And I know how to print things in Java like this: ``` int myInt = 10; System.out.println("My Integer equals " + myInt); ``` So how do I combine the two so that in Java, I can print multiple values just like I would in C#?

Original source

Related problems