So I have a char variable called "temp" which I'd like to compare to the element stored in "X" CharArray[X][Y] while I'm in a third for loop after the 2D array.
For example:
char temp;
temp = ' ';
String end;
end = "";
for (int i = 0; i < CharArray.length; i++){
        for (int m = 0; m < 2; m++){
            if (somethingY){
                if (somethingZ){
                    for (int j = 0; j < something.length; j++){
                        //something
                        temp = somethingX;
                        if (temp == String.valueOf(CharArray[i][m]).charAt(0)){
                            end = String.valueOf(CharArray[i][m]);
                            System.out.print(end);
                        }
                    }
                }
            }
        }
    }
I've tried printing "temp" where it says "temp = somethingX" and it prints just fine. But when I try to save the String into a String variable, it will not print the variable called "end".
According to this, it won't do anything if the object is something else, but "end" is a String.
So, what am I doing wrong?
EDIT: In case there's a confusion, "I'm trying to print "end", but I figured if temp == String.valueOf(CharArray[i][m]).charAt(0) is correct, so should "end"'s part.".
EDIT2: Defined "temp" for people...
EDIT3: I tried "end.equals(String.valueOf(CharArray[i][m]));", but still nothing happens when I try to print it. I get no errors nor anything.
EDIT4: I tried putting String.valueOf(CharArray[i][m]).charAt(0) into a another variable called "temp2" and doing if (temp == temp2), but still the same thing.
EDIT5: I tried temp == CharArray[0][m] and then end = CharArray[0][m], but still nothing prints.
EDIT6: OK. Sense this will never get resolved, I'll just say the whole point of my problem. -> I have an ArrayList where each line is a combination of a letter, space and a number (e.g. "E 3"). I need to check if a letter is repeating and if it is, I need to sum the numbers from all repeating letters.
For example, if I have the following ArrayList:
Z 3
O 9
I 1
J 7
Z 7
K 2
O 2
I 8
K 8
J 1
I need the output to be:
Z 10
O 11
I 9
J 8
K 10
I didn't want people to do the whole thing for me, but it seems I've no choice, since I've wasted 2 days on this problem and I'm running out of time.
 
     
    