Java IO Tutorial - 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;
//from w  w w  .  ja va 2s. c om
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.