First, install Homebrew, a very easy-to-use package manager. To install, open your Terminal and enter the following:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
During the process, you may be prompted to enter a password. When you enter your password, nothing will display on the terminal, but the computer is actually recording your password. This is a security measure. Just type your password and hit enter.
Then, check to make sure brew is working properly on your system.
You may encounter warnings like this, but you should be fine. Proceed to the next step.
If you encounter a warning asking you to download Command Line Tools, you will need to follow these StackOverflow instructions.
Finally, install the Java 10 JDK and git.
brew cask install java brew install git