Javatpoint Logo
Javatpoint Logo

Java Console printf() Method

The printf() method of Console class is used to write a formatted string to this console's output stream. This method used a specific format of string and arguments.

Syntax

Parameters

fmt: A format string as described in Format string syntax.

args: Arguments referenced by the format specifies in the format string.

Return value:

This method returns this console.

Exception:

IllegalFormatException: If a format string contains an illegal syntax.

Example 1

Output:

Sum of 12 and 45 is 57.

Example 2

Output:

Enter first value
12
Enter second value
23
First value  12 Second value  23 Addition is: 35. 

Example 3

Output:

 cse    program   language                                                                    -----      -----      -----PHP       Java     Python                                                                 
 CSS       Html JavaScript
Next TopicJava Console Class





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA