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
56 views
asked 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 by felin Advisor (8,400 points)

Related questions

0 votes
1 answer 8 views
8 views asked by john Guru (27,140 points)
0 votes
1 answer 922 views
922 views asked by sunny Expert (11,410 points)
0 votes
1 answer 44 views
44 views asked by john Guru (27,140 points)
+1 vote
1 answer 50 views
...