How can I create a method that recieve two arrays as parameters and return an array filled with the items that were in both arrays?
Input (Array1 passed in method): ["Lisa", "George", "Mario"] Input (Array2 passed in method): ["Luigi", "Susan", "Lisa"]
Method should return: ["Lisa"]
I cannot use any built in methods so I have to build my own algorithm, but I'm stuck for the past 2 hours. How can I achieve this in Java?
Edit: Christ on a candle stick. It's not for homework. I'm just real shitty at algorithms. Especially ones as basic as this, and especially on a foreign language I've never used. :P