Java program can be created by using any editor. The source code in java contains one or multiple number of classes. Naming a java program Java program must be saved with a .java extension. The primary name of the program must be same as class name if the class is declared as public. It can be any name if no class is declared as public. In one Java program there is only one public class. How to compile a java program To compile a java program in command prompt (CMD) Syntax- javac <file_name.java> Example- javac Hello.java How to run a java program To run a java program in command prompt Syntax- java class_name Example- java Hello
How to change the drive in CMD (Command Prompt) To access another drive, type the drive’s letter, followed by : For instance, if you wanted to change the drive from C: to E:, you should type- Example- E: ⤶ How to change the directory in CMD (CD in Command Prompt) The first command from the list is CD (Change Directory). This command enables you to change the current directory or, in other words, to navigate to another folder from your PC. Syntax- CD <Folder_Name> ⤶ Example- CD Saubhagya ⤶ How to go to the root of the drive in CMD (CD\) The first iteration of the CD command you should know is CD\. It takes you to the top of the directory tree. To see how it works, after you open the Command Prompt, type: Example- CD\ ⤶ How to change the parent directory in CMD (CD..) When you need to go one folder up, use the cd.. command. Let's assume that you’re inside the system32 folder and want to go back to the Windows folder. Type Example- CD.. ⤶