Question: Java Every device connected to a networkcomputer, tablet, camera, whateverneeds a unique identifier so that other devices know how to reach it. In the world
Java
Every device connected to a networkcomputer, tablet, camera, whateverneeds a unique identifier so that other devices know how to reach it. In the world of TCP/IP networking, that identifier is the Internet Protocol (IP) address. An IP address uniquely identifies a device on a network. Youve seen these addresses before; they look something like 192.168.1.34.
An IP address is always a set of four numbers like that. Each number can range from 0 to 255. So, the full IP addressing range goes from 0.0.0.0 to 255.255.255.255.
Write a program that prompts the user to enter an IP address. The fields will be separated by a '.' . Extract the 4 fields by slicing the string into 4 slices. Print out the Network ID and Host ID as shown in the example below.
For example:
| Input | Result |
|---|---|
192.168.1.34 | Enter an IP address: Network ID: 192, 168 and 1 Host ID: 34 |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
