Code reviewing

Report a typo

Wow, what kind of code is that anyway? There's clearly something going on in it that wasn't there in theory. Don't worry, there is no need to try to understand this code for now. In this task, you only need to determine the types of variables used in this program based on the values assigned to them.

Fill in the gaps with the relevant elements
public class Main {
    public static void main(String[] args) {
         haystack = "supercalifragilisticexpialidocious";
         haystackLength = 34;
         pattern = "cali";
         patternLength = 4;
         next;

        for (int i = 0; i < haystackLength - patternLength + 1; i++) {
            next = false;

            for (int j = 0; j < patternLength; j++) {
                if (haystack.charAt(i + j) != pattern.charAt(j)) {
                    next = true;
                    break;
                }
            }

            if (!next) {
                System.out.println("Pattern " + pattern + " found in " + haystack);
                break;
            }
        }
    }
}
booleanintintStringString

Create a free account to access the full topic