How do I uninstall Java 7 and later versions on my Mac?

Following the steps listed will uninstall Oracle Java from your system using a Terminal.

Click on the Finder icon located in your dock
Click on Applications tab on sidebar
Click on the Utilities folder
Double-click on the Terminal icon
In the Terminal window, copy and paste the command:

sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin

https://www.java.com/en/download/help/mac_uninstall_java.xml

How do I uninstall Java 7 and later versions on my Mac?