Turns out java has been moved into brew core recently, so the correct command as of January 2021 is:
brew install java
Don't be like me and follow old instructions to install from cask, it will not work. You will get an error message from brew like this:
% brew install --cask java
Error: Cask 'java' is unavailable: No Cask with this name exists.
You may also see this:
% brew cask install java
Error: Calling brew cask install is disabled! Use brew install [--cask] instead.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…