Can I use a variable in the following code?
String Var = "\"http://dl.dropbox.com/u/44966/xml%20ro开发者_如何转开发ma.xml\"";
URL url1 = new URL(Var);
Is it only allowed to use a literal string, as in the following line?
URL url1 = new URL("http://dl.dropbox.com/u/44966/xml%20roma.xml");
In my application it is imperative that I use a variable.
As long as the constructor of the URL class accepts a String object, you can pass it directly or through the usage of a variable.
But your string variable, to be equivalent with the example string you present, should be like this:
String Var = "http://dl.dropbox.com/u/44966/xml%20roma.xml";
精彩评论