Sujath Mohammed wrote:For some reason my validation seem to not work properly where if i type an element that's not in the array it repeats the word invalid
That "some reason" is because that's exactly what you're telling it to do. Your loop says, "For every element in the winners array, either print out the corresponding element in the years array (if the winners element matches the input), or print out 'invalid' (if it doesn't match the input)."
There's nothing there that says anything about "if the input wasn't found at all in the winners array." You need to work out how to do that
without any reference to Java. Just work out--clearly and precisely--how to to it "by hand." Then you can translate those steps to Java.
It's an odd requirement though. What you're saying is, if somebody enters a team that has never won, the response will be "Invalid," instead of something more sensible like, "That team has never won."
And finally, I'll note that the winners/years parallel arrays is a horrible way to manage this data.