VOOZH about

URL: https://www.geeksforgeeks.org/java/charset-newencoder-method-in-java-with-examples/

⇱ Charset newEncoder() method in Java with Examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Charset newEncoder() method in Java with Examples

Last Updated : 28 Mar, 2019
The newEncoder() method is a built-in method of the java.nio.charset constructs a new encoder for this charset. Syntax:
public abstract CharsetEncoder newEncoder()
Parameters: The function does not accepts any parameter. Return Value: The function returns a new encoder for this charset Errors and Exceptions: The function throws UnsupportedOperationException if the charset does not supports encoding. Below is the implementation of the above function: Program 1:
Output:
sun.nio.cs.UTF_8$Encoder@232204a1
Program2:
Comment