The close() method is a built-in method of the java.util.Formatter which closes the formatter. In case it is already closed, it will have no effect. Closing it means that it will release the resources that it is already holding.
public void close()
Parameters: The function accepts no parameter.
Return Value: The function returns nothing, it just closes the formatter. Hence the return type is void.
Below is the implementation of the above function:
What is your name? My name is Gopal Dave ! What is your name? My name is Gopal Dave !
Java programs are fun !
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.