InetAddress ToString() Example

Converts this IP address to a String.


InetAddressclass ToString() method example. This example shows you how to use ToString() method.This method Converts this IP address to a String.

Here is the code:-
/* 
 * @Program that Converts this IP address to a String.
 * ToString.java 
 * Author:-RoseIndia Team
 * Date:-19-Jun-2008
 */

import java.net.*;
public class ToString {
public static void main(String[] argsthrows UnknownHostException{
InetAddress ia = InetAddress.getLocalHost();
String s=ia.toString();
System.out.println("IP address to a String is: "+s);
    }
}

Output of the program:-
 IP address to a String is: girish-desktop/127.0.1.1

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US