1 // WhatMachine.java -- Find out what machine we are running on
2
3 import java.net.InetAddress;
4 import java.net.UnknownHostException;
5
6
7 class WhatMachine {
8
9 public static void main(String args[]) {
10 try {
11 final InetAddress myAddress = InetAddress.getLocalHost();
12 System.out.println (myAddress);
13 } catch (UnknownHostException e) {
14 System.out.println ("Machine name unknown!");
15 }
16 }
17
18 }