I want to create URL using : existing url and 2 strings
I found
Create URL from a Stringand
File.separator or File.pathSeparator
but I want to create it without typing '/'
String part1 = "txt1";
String part2 = "txt2";
URL urlBase = new URL(some adress);
now I can write
URL urlNew = urlBase.toURI().resolve(part1).toURL();
but how to add part2 goal is to get adress/txt1/txt2
URL urlNew = urlBase.toURI().resolve(part1 + "/" + part2).toURL();?URL urlNew = urlBase.toURI().resolve(part1 + (char)47 + part2).toURL();http://docs.oracle.com/javase/7/docs/api/java/net/URI.html#relativize(java.net.URI)might be useful. But I don't know this API very well.URL urlNew = urlBase.toURI().resolve(part1).resolve(part2).toURL();work?