Steps to Run Java in Command Prompt:- 1. Wite your Java code and Save it with ".java" extension. 2. Go to your f…