-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIPTest.java
More file actions
19 lines (14 loc) · 478 Bytes
/
IPTest.java
File metadata and controls
19 lines (14 loc) · 478 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package Networking;
import java.net.InetAddress;
import java.net.UnknownHostException;
public class IPTest {
public static void main(String[] args) throws UnknownHostException {
InetAddress inet = InetAddress.getLocalHost();
System.out.println(inet.getHostName());
System.out.println(inet.getHostAddress());
InetAddress inetArr[] = InetAddress.getAllByName("www.flipkart.com");
for (InetAddress i : inetArr) {
System.out.println(i.getHostAddress());
}
}
}