Java Charset.contains(Charset cs)

Syntax

Charset.contains(Charset cs) has the following syntax.

public abstract boolean contains(Charset cs)

Example

In the following code shows how to use Charset.contains(Charset cs) method.


import java.nio.charset.Charset;
/*from   w  w  w  .  ja  v a 2 s.co m*/
public class Main {


  public static void main(String[] args) {
    Charset csets = Charset.forName("UTF16");
    Charset csets1 = Charset.forName("UTF-8");
    System.out.println(csets.equals(csets1));

  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.nio.charset »




Charset
CharsetDecoder
CharsetEncoder
StandardCharsets