0

Updating a value of variable

Hi Coders, Is there a way to update the value of the variable "int month" in the code using a method from another class or the same class? if I change the int month to private and use Getters and Setters method, will it work? Or there is another way? I want the value to update so the "case" can change to. here is the code below: int month = 8; String monthString; switch (month) { case 1: monthString = "January"; break; case 2: monthString = "February"; break; case 3: monthString = "March";

9th Aug 2017, 3:50 PM
Sibusiso Mbambo
1 Answer
+ 1
i recomend you to use dictionary it will be fast and less code in your case
9th Aug 2017, 3:58 PM
Melih Melik Sonmez
Melih Melik Sonmez - avatar