forked from Rustam-Z/java-programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInetDemo.java
More file actions
15 lines (14 loc) · 433 Bytes
/
InetDemo.java
File metadata and controls
15 lines (14 loc) · 433 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import java.io.*;
import java.net.*;
public class InetDemo {
public static void main(String[] args) {
try{
InetAddress ip=InetAddress.getByName("www.google.com");
System.out.println("Host Name: "+ip.getHostName());
System.out.println("IP Address: "+ip.getHostAddress());
}
catch(Exception e) {
System.out.println(e);
}
}
}