forked from codehouseindia/Java-Programs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathURlclass.java
More file actions
21 lines (18 loc) · 663 Bytes
/
URlclass.java
File metadata and controls
21 lines (18 loc) · 663 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//https://www.facebook.com/naman.patidar.104/posts/1218126358573435
// subscribed code House youtube channel
import java.net.*;
import javax.swing.JOptionPane;
public class URL1 {
public static void main(String args[]) {
try {
URL u = new URL("https://google.com");
System.out.println("Protocol : " + u.getProtocol());
System.out.println("Host : " + u.getHost());
System.out.println("Port : " + u.getPort());
System.out.println("File : " + u.getFile());
}
catch(Exception e) {
JOptionPane.showMessageDialog(null , e);
}
}
}