This is my code that gives user random equations to test their knowledge and no errors are showing up. When I run the code it just doesn't compile in Eclipse. When I do in intelliJ Idea it runs but no code appears and I can't do anything.
package logical;
import java.util.Random;
import java.util.Scanner;
public class logical {
@SuppressWarnings("resource")
public static void main (String args[]){
    int qn1, qn2; //Numbers for the question
    int ua; //The users answer
    int answer; //The actual answer
    int counter = 0; //Controls the number of questions that can be answered
    int tally = 0; //Number of correct responses
    String again = "y";
    Scanner in = new Scanner(System.in);
    Random dice = new Random();
    while(again == ("y") || again == ("Y")){
    for(counter=1;counter>=5;counter++){
    qn1 = 1+dice.nextInt(40);
    qn2 = 1+dice.nextInt(40);
    answer = qn1 + qn2;
        System.out.printf("What is %d + %d",qn1,qn2);
        ua = in.nextInt();
        if(ua == answer){
            System.out.println("That is correct!");
            counter++;
            tally++;
        }
        else{
            System.out.println("Sorry, that is wrong! The correct answer is " + answer);
        }
        System.out.println("Would you like to try again?(Y/N)");
        again = in.next();
        if(again=="y" || again=="Y"){
            counter=0;
        }else {
            System.out.println("Thanks for playing your results were " + tally + " out of 5");
        }
        }
    }
    System.out.println("Thanks for taking the math challenge!");
}
}
 
     
     
     
     
     
    