Formatter out() method in Java with Examples
The out() method is a built-in method of the java.util.Formatter which returns the destination for the output by the formatter.
public Appendable out()
Parameters: The function accepts no parameter.
Return Value: The function returns the destination for the output.
Exceptions: The function throws FormatterClosedException if the formatter has been closed before the function call.
Below is the implementation of the above function:
What is your name? My name is Gopal Dave ! Destination: What is your name? My name is Gopal Dave !
What is your name? My name is Gopal Dave ! Exception is: java.util.FormatterClosedException
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.