Java IO Tutorial - 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;
// w w  w  .  j a  v a  2 s .c o 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.