Character.Subset Class represents 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 Object
Constructors :
- protected Character.Subset(String str) : Constructs new subset instance.
Methods:
- equals() : java.lang.Character.Subset.equals() tells wheteher the two Subset Object are equal or not.
Syntax :
public final boolean equals(Object o) Parameters : o : object to be compare with. Return : true : if o equals argumented object, else false.
- hashCode() : java.lang.Character.Subset.hashCode() returns the hashCode value of the Subset..
Syntax :public final int hashCode() Parameters : --- Return : hashCode of the argumented object.
- toString(): java.lang.Character.Subset.toString() returns name of the Subset.
Syntax :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 : for
Note :
lang.Character.Subset Class inherits others methods from java.lang.Object class. For details about java.lang.Object, refer :
Object class in Java.
This article is contributed by Mohit Gupta_OMG 😀. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Attention reader! Don’t stop learning now. Get hold of all the important Java and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.
Recommended Posts:
- Java.lang.Class class in Java | Set 1
- Java.lang.Class class in Java | Set 2
- Using predefined class name as Class or Variable name in Java
- Java.util.TimeZone Class (Set-2) | Example On TimeZone Class
- Implement Pair Class with Unit Class in Java using JavaTuples
- Implement Triplet Class with Pair Class in Java using JavaTuples
- Implement Quintet Class with Quartet Class in Java using JavaTuples
- Implement Quartet Class with Triplet Class in Java using JavaTuples
- Implement Octet Class from Septet Class in Java using JavaTuples
- Implement Ennead Class from Octet Class in Java using JavaTuples
- Implement Sextet Class from Quintet Class in Java using JavaTuples
- Implement Septet Class from Sextet Class in Java using JavaTuples
- Implement Decade Class from Ennead Class in Java using JavaTuples
- Difference between Abstract Class and Concrete Class in Java
- In Java, Can we call the main() method of a class from another class?
- Does JVM create object of Main class (the class with main())?
- Inner Class And Anonymous Inner Class that Implements Runnable | Concurrent Programming Approach 3
- Java.util.BitSet class methods in Java with Examples | Set 2
- Java.Lang.Float class in Java
- Java.io.BufferedInputStream class in Java

