out(): This method is available in java.util.Formatter class of Java.
Syntax:
Appendable java.util.Formatter.out()
This method returns the destination for the output.
Parameters: NA
Returns: The destination for the output.
Throws:
FormatterClosedException - If this formatter has been closed by invoking its close() method
Approach
Java
import java.util.Formatter;import java.util.Locale;public class Formatterout {public static void main(String[] args) {StringBuffer buffer = new StringBuffer();@SuppressWarnings("resource")Formatter formatter = new Formatter(buffer, Locale.UK);formatter.format("Hello %s ", "Java");System.out.println(formatter.out());}}
Output:
Hello Java
No comments:
Post a Comment