Question: Could you help me to change this code for 4 arguments instead of 3 and a code in JAVA please. Thanks //checking the number of
Could you help me to change this code for 4 arguments instead of 3 and a code in JAVA please. Thanks //checking the number of arguments given by the user and handling the program accordingly so that it will not break String[] arr=userInput.split(" "); if (arr.length==1) { search = arr[0]; getSearchResults(search, null, dictionary); } else if (arr.length==2) { if (arr[0].equalsIgnoreCase("placeholder")) search = arr[1]; else search = arr[0] + arr[1]; getSearchResults(search,null,dictionary); } else if (arr.length==3) { if (arr[0].equalsIgnoreCase("placeholder")) search = arr[1]; else search = arr[0] + arr[1]; getSearchResults(search, arr[2], dictionary); } } } public static void getSearchResults(String name, String arg2, Map dictionary) Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
