Java.lang.Character.Subset.toString() Method


Advertisements


Description

The java.lang.Character.Subset.toString() method returns the name of this subset.

Declaration

Following is the declaration for java.lang.Character.Subset.toString() method

public final String toString()

Parameters

NA

Return Value

This method returns a string representation of the object.

Exception

NA

Example

The following example shows the usage of java.lang.Character.Subset.toString() method.

package com.tutorialspoint;

import java.lang.*;

public class CharacterSubsetDemo extends Character.Subset {
  
   // constructor of super class
   CharacterSubsetDemo(String s) {
      super(s); 
   }

   public static void main(String[] args) {

      CharacterSubsetDemo str1 = new CharacterSubsetDemo("admin");
      CharacterSubsetDemo str2 = new CharacterSubsetDemo("webmaster");
      CharacterSubsetDemo str3 = new CharacterSubsetDemo("administrator");

      // returns a string representation of the object
      System.out.println("String1 = " + str1.toString());
      System.out.println("String2 = " + str2.toString());
      System.out.println("String3 = " + str3.toString());
   }
} 

Let us compile and run the above program, this will produce the following result −

String1 = admin
String2 = webmaster
String3 = administrator

java_lang_character.subset.htm

Advertisements