Java examples for Network:Network Address
get My Address as InetAddress
//package com.java2s; import java.net.InetAddress; import java.net.UnknownHostException; public class Main { public static void main(String[] argv) throws Exception { System.out.println(getMyAddress()); }/*from ww w .ja v a 2 s . co m*/ public static InetAddress getMyAddress() throws UnknownHostException { return InetAddress.getLocalHost(); } }