InetAddress

InetAddress Class

About InetAddress Class

InetAddress is one class. Using of this class we can find HostName and HostAddress of any website URL.

Example : 

Website URL : www.isssearch.in 

Host Name : www.isssearch.in

Host Address : 108.170.42.218

Program on InterAddress Class

import java.io.*;
import java.net.*;

class url1
{

public static void main(String args[]) throws IOException
{

try
{

InetAddress ip = InetAddress.getByName(“www.isssearch.in”); // for IP Address
System.out.println(“”+ip);

System.out.println(“IP Address : ” + ip.getHostAddress());

System.out.println(“Host Name : ” + ip.getHostName());

}
catch(Exception ex)
{

System.out.println(ex);

}

}

}

 

Output : 

isssearch.in/108.170.42.218

IP Address : 108.170.42.218

Host Name : isssearch.in

 


 

Download Program 

 

 

381total visits,4visits today


mayank

Hello, I am Maddy a Java blogger, trainer and developer

Related articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Your comments (*)

Name (*)

Your full name please.

Email address (*)

Used for gravatar.

Website

Link back if you want.

Enter Captcha Here :*

Reload Image