I tried this code
void setup(){
println(width, height);
size(400,300);
println(width, height);
}
and it produced the following
400 300
400 300
so your code would work. Interesting because in earlier versions of Processing this was not the case. I tried it in Processing 2.2.1 and got the result
100 100
400 300
So your code will not work correctly in all versions of Processing. It might seem a small thing but it is important to follow the Processing reference if you want code to behave consistenetly.