canEncode(): This method is available in java.nio.charset.Charset class of Java.
Syntax:
boolean java.nio.charset.Charset.canEncode()
This method tells whether or not this charset supports encoding. Nearly all charsets support encoding.
Parameters: NA
Returns: true if, and only if, this charset supports encoding
For Example:
Charset cs = Charset.forName("UTF-8")
cs.canEncode() = > It returns true.
Approach
Java
import java.nio.charset.Charset;public class CharsetcanEncode {public static void main(String[] args) {Charset cs = Charset.forName("UTF-8");System.out.println(cs.canEncode());}}
Output:
true
No comments:
Post a Comment