InnetAddress java

 avatar
Rohit143
java
2 years ago
732 B
24
Indexable
Never
import java.net.*;
public class practical14 {
    public static void main(String[] args) {
        try {
            InetAddress iAddress =InetAddress.getByName("www.extecy.in");
            System.out.println("Host Name : "+iAddress.getHostName());
            System.out.println("Ip Address : "+iAddress.getHostAddress());
            System.out.println("Local host Address : "+iAddress.getLocalHost());
            InetAddress ip[] = InetAddress.getAllByName("www.extecy.in");
            for (int i = 0; i < ip.length; i++) {
                System.out.println(ip[i]);
                
            }
            
        } catch (Exception e) {
            System.out.println(e);
        }

    }
    
}
jav