The Answer
You can update Java by downloading the newer version from Oracle directly When you install the installer would delete the older version for you.
The OLD Answer (no longer works)
Or you Mac has built in system that would fetch and update java from Oracle for you for you. Go to System Preference > Java > Update > Update Now. It would also be a good idea to turn on "Check for Updates Automatically" that way when a newer version of Java comes out your Mac would ask you to install it and it becomes a simple one click install.

The Answer
You can update Java by downloading the newer version from Oracle directly When you install the installer would delete the older version for you.
The OLD Answer (no longer works)
Or you Mac has built in system that would fetch and update java from Oracle for you for you. Go to System Preference > Java > Update > Update Now. It would also be a good idea to turn on "Check for Updates Automatically" that way when a newer version of Java comes out your Mac would ask you to install it and it becomes a simple one click install.

Just go to the java page and download the latest version. Upon starting the installation process, the installer automatically detects your current java version, either deletes it and does a complete reinstall or just updates your version.
How to update my installed Java version? The “install now” button doesn’t do anything.
macos - Java Update not working on Macbook - Ask Different
Latest Java update for Mac includes setting your homepage to Yahoo by default
Just as a quick update: It looks like it'll be possible to disable this for future updates under the Java Control Panel (found under System Preferences > Java). Choose the Advanced tab, then check "Suppress sponsor offers when installing or updating Java".
http://i.imgur.com/3Z0u4nX.png
More on reddit.comWhat is the best way to install Java with OS X?
Videos
Apple stopped supplying Java after Java 6. The Java control Panel was used to control Apple's Java releases and so does not provide later updates.
To get Java 8 you need to install from Oracle's Java pages. Note that the licence for these might involve some restrictions.
For later Java versions there are several other sources e.g. OpenJDK Azul
An easier way to install these versions might be to use a package manager like HomeBrew(although only for the most recent MacOS versions) or Macports.
There were an issue with the Update feature for your verion. Manually updating to a newer version will fix it.
I had the same problem fixed based on the advice in the article below. The update now work again.
"This article applies specifically to Oracle JRE 8u331 through 8u351 on macOS. Note that Oracle JDK 8 does not provide auto-update and thus this notice does not apply. Some users who installed Oracle JRE 8 on macOS (on any hardware platform) may experience issues with the Java auto-update feature. This affects Java versions 8u331 through 8u351 (April 19, 2022 through January 16, 2023)."
ref: https://www.java.com/en/download/help/java8_manual_update_macos.html
