toString(): This method is available in java.nio.charset.Charset class of Java.
Syntax:
String java.nio.charset.Charset.toString()
This method returns a string describing this charset.
Parameters: NA
Returns: A string describing this charset.
For Example:
Charset cs = Charset.forName("UTF-8")
cs.toString() = > It returns UTF-8.
Approach
Java
import java.nio.charset.Charset;public class CharsettoString {public static void main(String[] args) {Charset cs = Charset.forName("UTF-8");System.out.println(cs.toString());}}
Output:
UTF-8
No comments:
Post a Comment