Prints The Address Of The Machine It's Run On


Prints The Address Of The Machine It's Run On

Program

import java.net.*;
public class MyAddress {
public static void main (String[] args) {
try {
InetAddress address = InetAddress.getLocalHost( );
System.out.println(address);
}
catch (UnknownHostException e) {
System.out.println("Could not find this computer's address.");
}
}
}


Output:

sjt217.site060/127.0.0.1



Share:

0 comments