Java String format(String format)Example
String class format(String format) method example
String class format(String format) method example. This example shows you how to use format(String format) method.This method Returns a formatted string using the specified format string and arguments.
Here is the code:-
/*
* @(#) Formatstring1.java
*Program Returns a formatted string using the specified format string and arguments.
* @Version 01-May-2008
* @author Rose India Team
*/
import java.util.*;
public class Formatstring1
{
public static void main(String[] args)
{
long n = 461012;
//Returns a formatted string using the specified format string and arguments.
System.out.format("%d%n", n);
System.out.format("%08d%n", n);
}
} |
null
|