A Field-Width Specifier
From Java Example Source Code
Contents |
[edit] Overview - A Field-Width Specifier
This is a example of Java program.
[edit] Java Source Code
- Package: example.formatter4
- File: MainClass.java
package example.formatter4; /** *Output: |10.123450| | 10.123450| |00010.123450| */ import java.util.Formatter; public class MainClass { public static void main(String args[]) { Formatter fmt = new Formatter(); fmt.format("|%f|%n|%12f|%n|%012f|", 10.12345, 10.12345, 10.12345); System.out.println(fmt); } }
[edit] What Result You Can Get
Run the program, you will get:
|10.123450| | 10.123450| |00010.123450|
[edit] Required External Libraries and/or Files for this Java Example
Need nothing.
[edit] How to Run this Java Example Program
We recommend running this Java example program with Eclipse.
For assistance in working with Eclipse, please see How to Run Java Program with Eclipse.
It's fairly easy.
[edit] Question & Answer
Any question?
Click edit and post your question or answer here.
