I want to declare some static variables and use them a lot in my code, so in this example if I want to change the phone number I will change it in one place:
public class AppInformation{
static String phone_number="44444444";
}
So now I could get the phone_number by calling the class :
AppInformation.phone_number
;
Another solution:
public class AppInformation {
public static String get_phone_number(){
return "44444444";
}
}
Now I could call the method:
AppInformation.get_phone_number
();
Actually I prefer the second method because it is thread safe!
Is this correct? Are there any other suggestions?