JAVA URL类中的这个构造函数的参数是什么意思?
巴扎黑
巴扎黑 2017-04-17 17:50:53
0
1
409
URL
public URL(URL context,
           String spec)
    throws MalformedURLException

context参数是什么意思?

巴扎黑
巴扎黑

reply all(1)
大家讲道理

The path in

context是用来保存基路径的,新建的URL的路径会是context is spliced ​​together with the path in spec.
such as

URL baseURL=new URL("http://www.baidu.com");
URL url=new URL(baseURL,"img/bd_logo1.png");
String path=url.toString();//path为"www.baidu.com/img/bd_logo1.png"  
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template