CodesJava

Easy learning with example program codes

Create url object with properties in java

package com.codesjava;
 
import java.net.MalformedURLException;
import java.net.URL;
 
public class URLTest {
  public static void main(String args[]){
	try {
	    String protocol = "https";
            String host = "codesjava.com";
            int port = 8080;
            String path = "/object-oriented-design-principles-in-java-examples/";
            URL url = new URL(protocol, host, port, path);
            System.out.println(url.toString());
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
  }
}

Output

https://codesjava.com:8080/object-oriented-design-principles-in-java-examples/
Please follow and like us:
error








Copyright © 2019 CodesJava DMCA.com Protection Status