Charset.compareTo(Charset that) has the following syntax.
public final int compareTo(Charset that)
In the following code shows how to use Charset.compareTo(Charset that) method.
//from ww w . j a v a 2s .com import java.nio.charset.Charset; public class Main { public static void main(String[] args) { Charset csets = Charset.forName("UTF16"); Charset csets1 = Charset.forName("UTF-8"); System.out.println(csets.compareTo(csets1)); } }
The code above generates the following result.