Advertisement
Guest User

Untitled

a guest
Mar 21st, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. import java.io.*;
  2. import java.net.*;
  3. public class URLDemo{
  4. public static void main(String[] args){
  5. try{
  6. URL url=new URL("http://www.javatpoint.com/java-tutorial");
  7.  
  8. System.out.println("Protocol: "+url.getProtocol());
  9. System.out.println("Host Name: "+url.getHost());
  10. System.out.println("Port Number: "+url.getPort());
  11. System.out.println("File Name: "+url.getFile());
  12.  
  13. }catch(Exception e){System.out.println(e);}
  14. }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement