newDecoder(): This method is available in java.nio.charset.Charset class of Java.
Syntax:
CharsetDecoder java.nio.charset.Charset.newDecoder()
This method constructs a new decoder for this charset.
Parameters: NA
Returns: A new decoder for this charset.
For Example:
Charset cs = Charset.forName("UTF-8")
cs.newDecoder() = > It returns sun.nio.cs.UTF_8$Decoder@182decdb.
Approach
Java
import java.nio.charset.Charset;import java.nio.charset.CharsetDecoder;public class CharsetnewDecoder {public static void main(String[] args) {Charset cs = Charset.forName("UTF-8");CharsetDecoder decoder = cs.newDecoder();System.out.println(decoder.toString());}}
Output:
sun.nio.cs.UTF_8$Decoder@182decdb
No comments:
Post a Comment