[Solved] Adding Time Program Compiler Error: cannot find symbol [duplicate]


It may be a problem with scope (what’s declared inside the brackets may not be available after the brackets close). Not sure what Java is doing.

if (totalSeconds >= 60) {
    int intMinutesFromSeconds = (int) minutesFromSeconds;
}

int totalMinutes = intMinutesFromSeconds + ...

You can fix it with something like:

int intMinutesFromSeconds = 0;
if (totalSeconds >= 60) {
    intMinutesFromSeconds = (int) minutesFromSeconds;
}

int totalMinutes = intMinutesFromSeconds + ...

2

solved Adding Time Program Compiler Error: cannot find symbol [duplicate]