package com.immooc; /* * InetAddress class */ import java.net.InetAddress; import java.net.UnknownHostException; import java.util.Arrays; public class Test01 { /** * @param args */ public static void main(String[] args) throws UnknownHostException { // TODO Auto-generated method stub // Obtain the local InetAddress instance InetAddress = inetaddress.getLocalhost (); System.out.println(” address: “+ address.gethostName ()); System.out.println(“IP address: “+ address.gethostAddress ()); byte[] bytes=address.getAddress(); System.out.println(” IP: “+ array.toString (bytes)); }}