Javatpoint Logo
Javatpoint Logo

Java URL getRef() Method

The getRef() method of URL class returns the anchor(reference) of the URL or the null if not exist .

Syntax

Returns

The anchor (also known as the "reference") of this URL, or null if one does not exist

Example 1

Test it Now

Output:

Url reference is  : getRef--
The mime type is : text/html

Example 2

Output:

Enter Url 
https://docs.oracle.com/javase/9/docs/api/java/net/URL.html#getRef--
The reference of the given url is : getRef--
file: /javase/9/docs/api/java/net/URL.html
appended file: /javase/9/docs/api/java/net/URL.html#getRef--
Next TopicJava URL Class





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA