0

I'm trying to change a string variable in a switch statement like so:

ArrayList<String> listOfWeightLocations = new ArrayList<String>();
String weight;
ArrayList.add(weight);


Switch (num) {
    case 1:
        weight = "This";
        break;
    case 2:
        weight = "Other.";
        break;
    default:
        weight = "Another Either."
        break;
}

System.out.println(String.valueOf(listOfWeightLocations.get(0));

But it never changes the values. It stays as null.

Elgin Beloy
  • 93
  • 1
  • 6

0 Answers0