URI uri = new URI("https://www.example.com/path/to/resource?foo=1&bar=2#section"); String rawPath = uri.getRawPath(); System.out.println(rawPath); // Output: /path/to/resource
String urlString = "ftp://ftp.example.com/data/files/report.xlsx"; URI uri = URI.create(urlString); String rawPath = uri.getRawPath(); System.out.println(rawPath); // Output: /data/files/report.xlsxThis example creates a URI object from a string representation of a URL and then retrieves the raw path component using the `getRawPath()` method. The output is `/data/files/report.xlsx`. The `getRawPath()` method is located in the `java.net` package.