Syntax

Java Formatted Print Syntax

In Java, formatted print: prints a formatted string — System.out.printf("%s is %d%n", name, age);

Quick Answer

Syntax
System.out.printf("%s is %d%n", name, age);
JavaSyntax

Formatted Print

Code example
System.out.printf("%s is %d%n", name, age);

Prints a formatted string.

Learn More

How to formatted print in Java

  1. Open your Java file or editor.
  2. Copy the example, then replace its sample names and values for your code.

Java Formatted Print Syntax

Use System.out.printf("%s is %d%n", name, age);.

Related Syntax References

Frequently asked questions

What is the Java syntax for formatted print?

Use this pattern: System.out.printf("%s is %d%n", name, age);

Can I copy this Java code example?

Yes. Use Copy code and adapt the example to your program.

Is this Java syntax different on Mac or Windows?

No. The language syntax is the same across operating systems.

Official source · How we verify