S
stixwix
If I invoke the following code with 10 as the program argument, the
output is:
scaleFactor = 10
NUMBER_X = 10
Is there a mechanism for forcing the runtime value to be used as it
seems a bit clunky to do it by hand (i.e., by calling a method to
update it).
public class Test {
private static int scaleFactor = 1;
private static int NUMBER_X = 10 * scaleFactor;
public static void main(String[] args) {
if(args.length == 1){
scaleFactor = Integer.parseInt(args[0]);
}
System.out.println("scaleFactor="+scaleFactor);
System.out.println("NUMBER_X="+NUMBER_X);
}
}
cheers,
Andy
output is:
scaleFactor = 10
NUMBER_X = 10
Is there a mechanism for forcing the runtime value to be used as it
seems a bit clunky to do it by hand (i.e., by calling a method to
update it).
public class Test {
private static int scaleFactor = 1;
private static int NUMBER_X = 10 * scaleFactor;
public static void main(String[] args) {
if(args.length == 1){
scaleFactor = Integer.parseInt(args[0]);
}
System.out.println("scaleFactor="+scaleFactor);
System.out.println("NUMBER_X="+NUMBER_X);
}
}
cheers,
Andy