The book "
OCA Oracle Certified Associate Java SE 8 Programmer I: Study Guide" wants you to use the command line in the section of the book you are referring to. An
IDE like Netbeans or Eclipse will save you time in coding but it hides the details of the java programming language which you need to get a better understanding.
Steps to run your program in command line
1. Ensure you have installed the JDK, the latest being jdk 1.8.0_121. You will find it here:
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html. The default installed location is usually
C:\Program Files\Java but check to be sure. You need to know.
2. In a text editor such as notepad, notepad++, enter the code. Save the file and save the file name as
filename.java. Note the location of where this file is saved.
3. Open your command prompt and enter the location of filename.java. So if you saved that file in your Documents directory, then in command prompt simply enter
cd C:\Users\yourUserName\Documents and press enter. "cd" means change directory.
4. Set the path of the JDK. So enter the following
set path=%path%;C:\Program Files\Java\jdk1.8.0_121\bin and press enter.
You should not get any errors.
5.Compile the code by typing:
javac filename.java and press enter.
6. Run your code by typing:
java filename and press enter. Your output will show.
This link will help:
http://www.oracle.com/technetwork/java/compile-136656.html