java.lang.Character.Subset.toString() 方法返回該子集的名稱。
以下是java.lang.Character.Subset.toString()方法的宣告
public final String toString()
NA
此方法返回該物件的字串表示形式。
NA
下面的例子顯示java.lang.Character.Subset.toString()方法的使用。
package com.yiibai; 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