Question: Question Solution. import java.util.*; import java.lang.*; import java.io.*; Given an input IPv4 address as a string. Check whether the IPv4 address is valid. Input The

 Question "Solution". import java.util.*; import java.lang.*; import java.io.*; Given an input

Question "Solution". import java.util.*; import java.lang.*; import java.io.*; Given an input IPv4 address as a string. Check whether the IPv4 address is valid. Input The first line of the input consists of a string address/P, representing the IPv4 address. 6 7 */ 8 public class Solution 9-{ 10 public static String checkIPvalidity(String addressIP) 11 { 12 String answer = "hello"; 13 // Write your code here 14 15 16 return answer; 17 } 18 19 public static void main(String[] args) 20 { 21 Scanner in = new Scanner(System.in); 22 23 // input for addressIP 24 String addressIP = in.nextLine(); 25 26 String result = checkIPvalidity(addressIP); 27 System.out.print(result); Output Print a string 'VALID" if the IPv4 address is valid. Otherwise, print "INVALID." } Note The output should be VALID or INVALID. 31 Examples Example 1: Input: 10.102.34.48 Output: VALID Explanation: Here, all four parts of the IP address have ranges between 0 to 255. So the IP address is valid

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!