Java tutorial: how to use system.out.printf

Hi guys! In this tutorial I will speak about method system.out.printf. The method printf in Java can be used to produce output in a specific format.

How you can use the method printf?

System.out.printf("Number is %s", "a text that will replace %s");

So if you have:

System.out.printf("Number is %s", 100);

The output will be:

Number is 100;

You can use more than one argument.

System.out.printf("Number is %s or %s", 100, 200);

The output will be:

Number is 100 or 200;

Video tutorial:









Leave a Comment