The name() method is a built-in method of the java.nio.charset returns the charset's canonical name.
Syntax:
public final String name()
Parameters: The function does not accepts any parameter.
Return Value: The function returns the charset's canonical name.
Below is the implementation of the above function:
Program 1: