Last Updated : 13 Sep, 2023
Character.Subset Classrepresents particular subsets of the Unicode(standards using hexadecimal values to express characters - 16bit) character set. The subset, it defines in Character set is UnicodeBlock.
Declaration :public static class Character.Subset extends ObjectConstructors :
public final boolean equals(Object o) Parameters : o : object to be compare with. Return : true : if o equals argumented object, else false.
public final int hashCode() Parameters : --- Return : hashCode of the argumented object.
public final String toString() Parameters : --- Return : string representation of the argumented object.
// Java Program illustrating the use of Character.Subset class Methods.
import java.lang.*;
public class CharacterSubsetDemo extends Character.Subset
{
CharacterSubsetDemo(String s)
{
// Use of super keyword :
// Invokes immediate parent class constructor.
super(s);
}
public static void main(String[] args)
{
// Initializing two Subsets.
CharacterSubsetDemo a = new CharacterSubsetDemo("geeks");
CharacterSubsetDemo b = new CharacterSubsetDemo("for");
// use of equals() :
boolean check2 = a.equals(a);
System.out.println("Is a equals a ? : " + check2);
check2 = b.equals(a);
System.out.println("Is b equals a ? : " + check2);
System.out.println();
// Use of hashCode() :
int check1 = a.hashCode();
System.out.println("hashCode " + a + " : " + check1);
check1 = b.hashCode();
System.out.println("hashCode " + b + " : " + check1);
System.out.println();
// Use of toString() :
System.out.println("a : " + a.toString());
System.out.println("b : " + b.toString());
}
}
Output :
Is a equals a ? : true Is b equals a ? : false hashCode geeks : 366712642 hashCode for : 1829164700 a : geeks b : forNote :
lang.Character.Subset Class inherits others methods from
java.lang.Objectclass. For details about java.lang.Object, refer :
Object class in Java.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4