Q:

How to display different scores from a different category in just one page

I have 3 different categories (different frames each), those are connected by 'continue' button and the last frame is the 'done' button. After clicking the 'done' button, i want to display the result (by points) of each categories but whenever i click the done button the score of the last category is the same score as the two categories. Please help me I don't know how to do it.
Please note that I don't have codes in my 2 other frames to display the score in a result form
//here is my code in my last frame... 
try {
    ResultSet rs = stmt.executeQuery(
        "Select * from Questions where exam_category= 'Mathematics'");

    while (rs.next()) {
        Questions x = new Questions(
            rs.getString("Question_Id"), 
            rs.getString("Subject_Code"), 
            rs.getString("Exam_Category"),
            rs.getString("Question"), 
            rs.getString("Choice_A"), 
            rs.getString("Choice_B"),
            rs.getString("Choice_C"), 
            rs.getString("Choice_D"), 
            rs.getString("Answer"));
        list.add(x);
    }

    for (int i = 0; i < list.size(); i++) {
        if(list.get(i).getAnswer().equals(userAnswer.get(i).toString())) {
            score++;
            System.out.print(score);
        }
    }

    new Result(score, list).setVisible(true);
    this.dispose();

} catch (SQLException ex) {
    Logger.getLogger(LogicalReasoning.class.getName()).log(Level.SEVERE, null, ex);
}

//here is my code in my result form
public Result(int score, ArrayList<Questions> list) {
    initComponents();
    txtLogical.setText(String.valueOf(score + " out of " + list.size()));
    txtEnglish.setText(String.valueOf(score + " out of " + list.size()));
    txtMath.setText(String.valueOf(score + " out of " + list.size()));
}

A:

Try something along these lines: 
Result should get all the scores from the 3 topics, so I would change it to:
public Result(int[] logicalResult, int[] englishResult, int[] mathResult) {
    initComponents();        
    txtLogical.setText(logicalResult[0] + " out of " + logicalResult[1]);
    txtEnglish.setText(englishResult[0] + " out of " + englishResult[1]);
    txtMath.setText(mathResult[0] + " out of " + mathResult[1]);
}

Each topic result is an int[] which has 2 values in it, the score and the number of questions for the topic.
Then to feed that, I would have a method that returns that little int[] for a given topic, so taking your current implementation, it would be something like this: 
private int[] getScoreForTopic(String topic, List<Answer> userAnswers) {
    int score = 0;
    List<Questions> list = new ArrayList<>();

    try {

        Connection con;
        // instantiate your connection

        PreparedStatement stmt = con.prepareStatement(
           "Select * from Questions where exam_category= ?");
        stmt.setString(1, topic);
        ResultSet rs = stmt.executeQuery();

        while (rs.next()) {
            Questions x = new Questions(
                    rs.getString("Question_Id"),
                    rs.getString("Subject_Code"),
                    rs.getString("Exam_Category"),
                    rs.getString("Question"),
                    rs.getString("Choice_A"),
                    rs.getString("Choice_B"),
                    rs.getString("Choice_C"),
                    rs.getString("Choice_D"),
                    rs.getString("Answer"));
            list.add(x);
        }

        for (int i = 0; i < list.size(); i++) {
            if(list.get(i).getAnswer().equals(userAnswer.get(i).toString())) {
                score++;
                System.out.print(score);
            }
        }

    } catch (SQLException ex) {
        // ...
    }

    return new int[] {score, list.size()};
}

Finally, you create the Result object this way: 
int[] logicalResult = getScoreForTopic("Logical", userAnswerLogical);
int[] englishResult = getScoreForTopic("English", userAnswerEnglish);
int[] mathResult = getScoreForTopic("Mathematics", userAnswerMath);

new Result(logicalResult, englishResult, mathResult).setVisible(true);
this.dispose();

