On Ubuntu I can do:
sudo apt-get install default-jdk
What is the equivalent of that on CentOS?
If I do
yum install default-jdk
tt says
No package default-jdk available.
Error: Nothing to do
yum install java
This will install the latest java openjdk available in CentOS (1.8.0_151 as of this post). Here are other examples.
yum whatprovides *bin/java
will show you every package that provides the java binary, including the 1.6.0 and 1.7.0 openjdk's.
yum search java
will show you everything that is related to java, whether or not that it provides the java binary or not.