Question: Write a program that returns true if two given strings are nearly identical. Nearly identical means that either all of their characters match, or all

Write a program that returns true if two given strings are nearly identical. Nearly identical means that either all of their characters match, or all but one match. The strings can be upper or lower case and still be considered nearly identical. Both strings will also need to be the same length to be considered nearly identical.

public class Problem19 { public static void main(String[] args) { System.out.println(nearlyIdentical("Test","Tost")); // True System.out.println(nearlyIdentical("Java","J ava")); // False System.out.println(nearlyIdentical("abcdef","abddef")); // True System.out.println(nearlyIdentical("poolside","sidepool")); // False } public static boolean nearlyIdentical(String phrase1, String phrase2) { // Your code here } }

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!