With the constructor ‘URL(URL baseURL, String relativeURL)’, you can do the below things:
URL baseUrl = new URL("http://localhost:4567/");
URL url = new URL(baseUrl, "123/asd")
The output will be: http://localhost:4567/123/asd
Interested in Java? Check out this Java tutorial by Intellipaat.