阅读背景:

给出两个单词,返回两个单词中出现的字母列表 - Java

来源:互联网 

I have another challenge, it is when the user inputs 2 words, java prints to the console a list of letters that occur in both words. My thought was to create a char array out of the two inputs. But when I did that, I realized that some words are longer than others (Obviously), so I used an if statement to account for both possibilities (word one is bigger than word 2 and vice versa). When I did that, I got an ArrayIndexOutOfBoundsException. I do not know how else to do this. I have looked on StackOverflow for other solutions. Please help! My method for the challenge is below. PS: This is a challenge "within a challenge", I have to have the user choose 1 of five programs. When the user chooses 3, it runs the program below.I have another challenge, it is when the user i




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: