URL Constructor Test : URL : Network Protocol : Java examples (example source code) Organized by topic

Java
C++
PHP
Java Home »  Network Protocol   » [  URL  ]  Screenshots 
 



URL Constructor Test

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

public class URLConstructorTest2 {

  public static void main (String args[]) {
  
    URL webURL, ftpURL;
  
    try {
      webURL = new URL("http://www.macfaq.com/vendor.html");
      System.out.println(webURL);
      ftpURL = new URL("ftp://ftp.macfaq.com/pub/");
      System.out.println(ftpURL);

      webURL = new URL("http""www.macfaq.com""/vendor.html");
      System.out.println(webURL);  
      ftpURL = new URL("ftp""ftp.macfaq.com""/pub");   
      System.out.println(ftpURL);

      webURL = new URL("http""www.macfaq.com"80"/vendor.html");
      System.out.println(webURL);  
      ftpURL = new URL("ftp""ftp.macfaq.com"21"/pub");   
      System.out.println(ftpURL);

    }
    catch (MalformedURLException e)  {
      System.err.println(e);
    }
  
  }

}

           
       
Related examples in the same category
1.  URL Encode Test
2.  Get URL Content
3.  Get URL Parts
4.  Read from a URL
5.  URL Equality
6.  URL Request
7.  URL Get
8.  URL Reader
9.  URL Connection Reader URL Connection Reader
10.  URLConnection
11.  Parse URL Parse URL








Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.