Java URL getRef() MethodLast Updated : 17 Mar 2025 The getRef() method of URL class returns the anchor(reference) of the URL or the null if not exist . SyntaxReturnsThe anchor (also known as the "reference") of this URL, or null if one does not exist Example 1Output: Url reference is : getRef-- The mime type is : text/html Example 2Output: 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 |
We request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India