Question: Task #2 String Comparison with Wild Card Write a complete Java program that takes two strings and returns true if and only if the two

Task #2 String Comparison with Wild Card Write a complete Java program that takes two strings and returns true if and only if the two strings are of equal length and are equal, character for character, except that a '?' in either string counts as a wild card which matches any character in the corresponding position of the other string. The strings may be any length, including 0. For example: string] result string2 "ab" "abc" false true abc" "abc" true "abc" "aeb" false ab?" "abd" true "a?c" "adc" true "ab?" "a? " true The following are sample interactions. The user's input is shown in bold. $ java String ComparisonWithWildcard enter string 1: ab? enter string 2: a? they are equal $ java String ComparisonWithWildcard enter string 1: abc enter string 2: abcd they are different $ java String ComparisonWithWildcard enter string 1: ab? de enter string 2: abzde they are equal
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
