0% found this document useful (0 votes)
3 views1 page

Java 6

The document contains a Java program that demonstrates the use of the InetAddress class to retrieve and display the local host name and IP address, as well as the remote host name and IP address for 'www.google.com'. It also lists all IP addresses associated with 'www.google.com'. The program handles exceptions that may occur during execution.

Uploaded by

sahiljadhav9304
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Java 6

The document contains a Java program that demonstrates the use of the InetAddress class to retrieve and display the local host name and IP address, as well as the remote host name and IP address for 'www.google.com'. It also lists all IP addresses associated with 'www.google.com'. The program handles exceptions that may occur during execution.

Uploaded by

sahiljadhav9304
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Assignment No 6

Name: Sahil Shrimant Jadhav


Batch: IT
Roll No : 231326

Code:

import [Link].*;

public class InetAddressDemo {

public static void main(String[] args) {


try {

InetAddress local = [Link]();


[Link]("Local Host Name: " + [Link]());
[Link]("Local IP Address: " + [Link]());

InetAddress remote = [Link]("[Link]");


[Link]("\nRemote Host Name: " + [Link]());
[Link]("Remote IP Address: " + [Link]());

InetAddress[] all = [Link]("[Link]");


[Link]("\nAll IP Addresses:");
for (InetAddress addr : all) {
[Link]([Link]());
}

} catch (Exception e) {
[Link](e);
}
}
}

Output:

You might also like