Java Charset.equals(Object ob)

Syntax

Charset.equals(Object ob) has the following syntax.

public final boolean equals(Object ob)

Example

In the following code shows how to use Charset.equals(Object ob) method.


import java.nio.charset.Charset;
/*ww  w.  jav  a2  s.  c o  m*/
public class Main {


  public static void main(String[] args) {
    Charset csets = Charset.forName("UTF-8");
    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