Java Character.SubSet toString()方法

java.lang.Character.SubSet.toString() 方法返回该子集的名称。

1 语法

public final String toString()

2 参数

3 返回值

此方法返回该对象的字符串表示形式。

4 示例 

package com.yiidian;

/**
 * 一点教程网: http://www.yiidian.com
 */
/**
 * java.util.Calendar getInstance()方法的例子
 */
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());
   }
}

输出结果为:

String1 = admin
String2 = webmaster
String3 = administrator

 

热门文章

优秀文章