To install Java on CentOS 8, you can follow these steps:
sudo yum install -y yum-utils sudo yum-config-manager --enable ol7_developer_EPEL sudo yum-config-manager --enable ol7_optional_latest
sudo yum install java-11-oracle-devel
sudo alternatives --set java /usr/java/latest/bin/java
java -version
Note that these steps will install the Oracle version of Java 11. If you prefer to install the OpenJDK version of Java 11, you can use the following command instead of step 2:
sudo yum install java-11-openjdk-devel
For more information on installing Java on CentOS 8, you can refer to the Oracle documentation or the OpenJDK documentation.