You cannot run a Java program in Notepad, but you can run it using your command prompt by following the mentioned steps:
Step 1:
Search what is the location of the program where it is saved
Step 2:
Let’s say your program is saved with name demo then type the following command in the cmd prompt
Note: Now you are inside your folder where you have saved your program, simply execute the following command and your program will start executing
Java Example.jav