Java toString() 方法
toString() 方法返回此對(duì)象本身(它已經(jīng)是一個(gè)字符串)。
語(yǔ)法
public String toString()
參數(shù)
無(wú)
返回值
字符串本身。
實(shí)例
public class Test { public static void main(String args[]) { String Str = new String("www.o2fo.com"); System.out.print("返回值 :" ); System.out.println( Str.toString() ); } }
以上程序執(zhí)行結(jié)果為:
返回值 :www.o2fo.com
更多建議: