forked from deepdalsania/tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathURL_Demo.java
More file actions
32 lines (24 loc) · 963 Bytes
/
URL_Demo.java
File metadata and controls
32 lines (24 loc) · 963 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package netpck;
import java.net.MalformedURLException;
import java.net.URL;
public class URL_Demo {
/**
* @param args
* @throws MalformedURLException
*/
public static void main(String[] args) throws MalformedURLException {
// TODO Auto-generated method stub
URL url=new URL("https://www.tutorialspoint.com/mongodb/mongodb_advantages.htm");
//1/11/2019
System.out.println("Protocol: "+url.getProtocol());
System.out.println("Port Number: "+url.getPort());
System.out.println("getDefaultPort: "+url.getDefaultPort());
System.out.println("getAuthority: "+url.getAuthority());
// System.out.println("Host Name: "+url.getHost());
System.out.println("getPath: "+url.getPath());
// System.out.println("File Name: "+url.getFile());
System.out.println("getQuery: "+url.getQuery());
System.out.println("getRef: "+url.getRef());
System.out.println("toExternalForm: "+url.toExternalForm());
}
}