Will this code even run? The reference a is null and we invoke a method on it: a.go(). Won't it throw a NullPointerException?

It does run, no exceptions are thrown, and the output is:

Example 3
1: A1

This behavior is described in section 15.12.4 of JLS8,
and it cements the idea that you should always think of static methods as belonging to the class even when they are invoked through a reference. When you're reading code that invokes static methods on reference, follow the complier's lead: ignore the reference. Pay attention only to the reference's type.

Also, as mentioned in Example02, where possible, invoke static methods through the class itself. That is, do this: A.go(); not this: a.go(). This practice will reduce confusion and produce programs that are more easily understood.

Dedication

My grandfather had a wonderful shop in his basement. To me, it was a place of mystery and fascination, and I would spend hours wandering through it, looking at all the tools and projects in various states of completion. Not being much of a wood worker, I've never had the need for such a shop (not to mention that I lack a basement), but recently it occurs to me that my gear, computers, and software are my shop. This site is for my late grandfather and everyone else who takes personal pride in carefully executed work.