Java

How to create Java URL object

By March 20, 2016 November 9th, 2016 No Comments

package com.myjava.url;

import java.net.MalformedURLException;
import java.net.URL;

public class MySimpleUrl {
public static void main(String a[]){
try {
String myUrl = “http://www.csrockers.in”;
URL url = new URL(myUrl);
System.out.println(url.toString());
} catch (MalformedURLException ex) {
ex.printStackTrace();
}
}
}




Example Output

Home

Leave a Reply