Java program to display Domain name service (DNS)

Write a Java program to display Domain name service (DNS).

[java]

import java.net.*;

class dns
{
public static void main(String args[]) throws Exception
{
try
{
InetAddress[] address=InetAddress.getAllByName("java.sun.com");
for(int j=0;j<address.length;j++)
System.out.println(address[j]);
}
catch(Exception e)
{
System.out.println("Error in accessing Internet :"+e);
}
}
}

[/java]

Share

About the Author

Akash Padhiyar

Visit Website

There are no comments yet, add one below.

Leave a Comment

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

*

Time limit is exhausted. Please reload CAPTCHA.