Write a JAVA CODE CORRECTLY that starts with 2 strings. If one string is odd and the other string is even then it will place the odd string in the middle of the even string. But if both Strings are of odd length then it will concatenate the first letter of the first string with the LAST letter of the second string. And finally, if the strings are both of Even length then it will take the first half of the first string and concatenate it with the second half on the second string.
Java programming only!!
Use below to see if the code is correct
connectStrings(“hello”,“back”) → “bahellock”
connectStrings(“hello”,“bad”) → “hd”
connectStrings(“you”,“good”) → “goyouod”
connectStrings(“good”,”game”) → “gome”
public static String connectStrings(String str1, String str2)
{
}