Can someone please tell me why I am getting an 'else' without 'if' error message when I try to compile the following code:
I can't figure out what I am doing wrong. It states that the problem is at the else lineCode:
public class Example3 {
public static void main(String [] args){
int nums[] = new int[50];
for(int i = 0; i < 50; i++){
if(i % 2 == 0){
nums[i] = 1;
else{
nums[i] = 0;
System.out.println(nums[i]);
}
}
}
}
}

