import java.net.*; public class Test { public static void main(String[] args) throws Exception { InetAddress localhost = InetAddress.getLocalHost(); InetAddress[] addresses = InetAddress.getAllByName(localhost.getHostName()); for (int i = 0; i < addresses.length; i++) { System.out.println(addresses[i]); } } }