r/learnjava • u/[deleted] • Jun 22 '22
Missing '}' or illegal start of expression
Hello,
The code below is presenting a "missing '}' or illegal start of expression" error. I'm kind of confused what could be causing this. I'm sure it is very simple but I'm obviously not understanding why this boolean return isn't allowed.
public boolean array123(int[] nums) {
boolean seqExist = false;
for(int i = 0; i < (nums.length-2); i++){
if (nums[i] == 1) && (nums[i+1] == 2) && (nums[i+2] == 3) {
seqExist = true;
}
}
return seqExist;
}
1
Upvotes
-5
u/Loud-Airport-9014 Jun 22 '22
Add } at the end