Java URL toString() 方法

2025年3月24日 | 1 分钟阅读

URL 类的 toString() 方法构造该 URL 的字符串表示形式。该字符串是通过调用此对象的流协议处理程序的 toExternalFile() 方法来创建的。

语法

覆盖

Object 类中的 toString

返回值

此对象的字符串表示形式。

示例 1

输出

The given url is : https://tpointtech.cn/java-tutorial
User information of given url is : https://tpointtech.cn/java-tutorial

示例 2

输出

Given URL is : https://tpointtech.cn/URL-class
 File name in given url : URL-class
下一个主题Java URL 类