URI: getFragment()
import java.net.URI; import java.net.URISyntaxException; public class Main { public static void main(String[] args) throws NullPointerException, URISyntaxException { URI uri = new URI("http://www.example.org"); System.out.println("URI : " + uri); System.out.println("Raw Authority : " + uri.getRawAuthority()); System.out.println("Raw Fragment : " + uri.getRawFragment()); System.out.println("Fragment : " + uri.getFragment()); System.out.println("Authority : " + uri.getAuthority()); System.out.println("Authority : " + uri.getRawPath()); System.out.println("RawQuery : " + uri.getRawQuery()); System.out.println("RawSchemeSpecificPart : " + uri.getRawSchemeSpecificPart()); System.out.println("RawUserInfo : " + uri.getRawUserInfo()); } }