Monday, August 8, 2016

Java - String Format

String Format

Description:

String.format() method helps us to format the given string.
It replaces each format item in a specified string with the text equivalent of a corresponding object's value.


Syntax:
Here is the syntax of this method:

public static String format(String format, Object... args)


Parameters:
format : format of the string.
args : arguments for the format string. It may be zero or more.

Return Value
formatted string

String.format() Example Program
Write a Program to Add spaces before and After a String using String.format()
Write a program for a String must contain three digit using String.format()

No comments :

Post a Comment