Program to get IP address

In this example we are gonna see how to get IP address of a System. The steps are as follows: 1) Get the local host address by calling getLocalHost() method of InetAddress class.2) Get the IP address by calling getHostAddress() method. Output:

Program to read integer value from the Standard Input

Example: Program to read the number entered by user We have imported the package java.util.Scanner to use the Scanner. In order to read the input provided by user, we first create the object of Scanner by passing System.in as parameter. Then we are using nextInt() method of Scanner class to read the integer. If you are new to Java… Continue reading Program to read integer value from the Standard Input