'longest prefix String in an Array

why showing out of bond index(if(strs[j].charAt(i)!=c) )?

            char c=strs[0].charAt(i);
            for(int j=1;j<strs.length;j++){
                if(strs[j].charAt(i)!=c)
                    return s;


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source