Create url from file in java

Create url from file in java

package com.w3spoint;
 
import java.net.MalformedURLException;
import java.net.URL;
 
public class URLTest {
  public static void main(String args[]){
	try {
	    URL url = new URL("file://D:/data");
            System.out.println(url.toString());
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
  }
}

Output

file://D:/data
Content Protection by DMCA.com
Please Share