A Field-Width Specifier

From Java Example Source Code

Jump to: navigation, search

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.

http://www.ase2009.com/ online casino 132 http://www.hellzyea.com/health health insurance 8DDD http://www.yourautoinsurancesite.com/ auto insurance quotes 135811 http://www.makemeasammich.com/ auto insurance mcnxu

[edit] Question & Answer

Any question?

Click edit and post your question or answer here.


Personal tools