In 5.0, the Java™ programming language introduces a new output formatter method printf like C Language. The printf method is introduced in the java.io.PrintStream class of java. The general syntax of the printf method is as follows :-
printf(Locale l,String format, Object...args) and,
printf(String format, Object...args)
Example:-
The following example will demonstrate the use of printf method.
package com.visualbuilder;
public class PrintfExample {
public static void main(String[] args) {
System.out.printf("I got %d marks",10);
}
}
Output:-
The following output gets printed on the console.
I got 10 marks
Java Discussion
- - Java web application
- - Difference between BMT an
- - Replace getParameterValue
- - Interviewing Next week -
- - Sudoku solver





