import java.net.InetAddress;
import java.net.UnknownHostException;
 
public class Print{
  public static void main(String[] args){
    try{
      System.out.println( InetAddress.getLocalHost().getHostName() );
      System.out.println( InetAddress.getLocalHost().getHostAddress() );
    }
    catch( UnknownHostException e ){
      e.printStackTrace();
    }
  }
}
간단하다.

출처 : http://blog.naver.com/websearch/70086250465
Posted by 서오석
,