-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathNet1.java
More file actions
21 lines (20 loc) · 730 Bytes
/
Net1.java
File metadata and controls
21 lines (20 loc) · 730 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import java.net.*;
//LEC TWO
//EXTRACTING DIFF PARTS OF URL
public class Net1 {
public static void main(String[] args) {
URL url = null;
try {
url = new URL("https://blog.openreplay.com/an-introduction-to-babel/");
System.out.println("Host: " + url.getHost());
System.out.println("Protocol : " + url.getProtocol());
System.out.println("Port : " + url.getPort());
System.out.println("Filename : " + url.getFile());
System.out.println("Ref : " + url.getRef());
System.out.println("Parh: " + url.getPath());
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
}