Write a java program to display IPAddress and name of client machine.
import java.net.InetAddress;
public class ClientInfo {
public static void main(String[] args) {
try {
// Get local host information
InetAddress inet = InetAddress.getLocalHost();
// Display client machine details
System.out.println("Client Machine Name : " + inet.getHostName());
System.out.println("Client IP Address : " + inet.getHostAddress());
} catch (Exception e) {
System.out.println(e);
}
}
}