C Books Guide and List
C++ Books Guide and List
Best Java Books

3,749 questions

4,049 answers

114 comments

10,705 users

How to use Java Format Specifier?

0 votes
54 views
asked May 4, 2014 by rock Expert (14,990 points)

1 Answer

0 votes
import java.util.Calendar;
import java.util.Formatter;
 
public class Main {
  public static void main(String args[]) {
    Formatter fmt = new Formatter();
 
    fmt = new Formatter();
    System.out.println(fmt.format("%s gap filler %d %f", "Astring", 10, 12.3)); 
  
  }
}
You can obtain a reference to the underlying output buffer by calling out(). It returns a reference to an Appendable object.
 
The code above generates the following result.
 
Astring gap filler 10 12.300000
 
 
answered May 4, 2014 by felin Advisor (8,400 points)

Related questions

0 votes
1 answer 7 views
7 views asked May 4, 2014 by john Guru (27,140 points)
0 votes
1 answer 14 views
0 votes
1 answer 918 views
918 views asked May 5, 2014 by sunny Expert (11,410 points)
0 votes
1 answer 42 views
42 views asked May 4, 2014 by john Guru (27,140 points)
+1 vote
1 answer 46 views
...