Get reference anchor from a URL in Java
Description
The following code shows how to get reference anchor from a URL.
Example
import java.net.URL;
// w w w . ja va 2 s . com
public class Main {
public static void main(String[] args) throws Exception {
URL url = new URL("http://www.yahoo.com:80/en/index.html?name=joe#first");
System.out.println("ref:" + url.getRef());
}
}
The code above generates the following result.