Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.net.InetAddress;

public class Main {
    public static void main(String[] args) throws Exception {
        InetAddress address = null;
        if (args.length == 0) {
            System.out.println("usage: GetIP host");
            System.exit(1);
        }

        address = InetAddress.getByName(args[0]);
        System.out.println(address.getHostName() + "=" + address.getHostAddress());
        System.exit(0);
    }
}