import java.net.URL;
import java.net.MalformedURLException;
class Test {
URL root
= new URL("http://localhost/dir/"); URL combined
= new URL(root,
"/path"); System.
out.
println("Combined is: " + combined.
toString()); }
}
aW1wb3J0IGphdmEubmV0LlVSTDsKaW1wb3J0IGphdmEubmV0Lk1hbGZvcm1lZFVSTEV4Y2VwdGlvbjsKCmNsYXNzIFRlc3QgewogICAgcHVibGljIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nW10gYXJncykgdGhyb3dzIE1hbGZvcm1lZFVSTEV4Y2VwdGlvbiB7CglVUkwgcm9vdCA9IG5ldyBVUkwoImh0dHA6Ly9sb2NhbGhvc3QvZGlyLyIpOwoJVVJMIGNvbWJpbmVkID0gbmV3IFVSTChyb290LCAiL3BhdGgiKTsKICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oIkNvbWJpbmVkIGlzOiAiICsgY29tYmluZWQudG9TdHJpbmcoKSk7CiAgICB9Cn0K