WBahn wrote
This is one of the more subtle -- and clever -- schemes of the VM. But it's pretty easy to see how it all works.
Yes, each class has it's own private static segment, but when you compile Class A to assembly, the variable that it knows as Static 0 gets a name something like A-static-0 while the variable that Class B knows as Static 0 gets a name like B-static-0. Since no two classes in the same Jack program can have the same class name, all of the static variables in all the classes end up with unique names in the assembly language code.
Just a small caveat. The book suggests to use names in the format ClassName.0, ClassName.1, etc. Recently somebody reported a problem with one of the tools breaks with a Java exception if it can't find a dot in the name. So it's better to stick to the suggested notation.