Java 的 toString() 方法。

java 8object oriented programmingprogramming

String 类的 toString() 方法将自身返回为字符串。

示例

import java.io.*;
public class Test {
   public static void main(String args[]) {
      String Str = new String("Welcome to Tutorialspoint.com");
      System.out.print("Return Value :");
      System.out.println(Str.toString());
   }
}

输出

Return Value :Welcome to Tutorialspoint.com

相关文章