The following is the Java code for getting IP address and system name.
- import java.net.InetAddress;
- class DemoIp {
- public static void main(String args[]) throws Exception {
- System.out.println("Your system name & your IP Address is:");
- System.out.println(InetAddress.getLocalHost());
- }
- }
Thank you, keep learning and sharing.