How to get started with Java

Check if Java is installed: You can do this by typing the following in Command Prompt (cmd.exe): java -version. If Java is installed, you will see something like this: java version "11.0.1" 2018-10-16 LTS1.<br><br> Install Java: If you do not have Java installed on your computer, you can download it for free at oracle.com1.<br><br> Set up your environment: To install Java on Windows, go to “System Properties” (Can be found on Control Panel > System and Security > System > Advanced System Settings). Click on the “Environment variables” button under the “Advanced” tab. Then, select the “Path” variable in System variables and click on the “Edit” button1.<br><br> Write your first program: In Java, every application begins with a class name, and that class must match the filename. Let’s create our first Java file, called Main.java, which can be done in any text editor (like Notepad). The file should contain a “Hello World” message1.<br><br> Here’s a simple example of a Java program:<br><br> <pre> public class Main { public static void main(String[] args) { System.out.println("Hello, World!"); } } </pre><br><br> Compile and run your program: Save the code in Notepad as “Main.java”. Open Command Prompt (cmd.exe), navigate to the directory where you saved your file, and type javac Main.java. This will compile your code. If there are no errors in the code, the command prompt will take you to the next line. Now, type java Main to run the file1.

Coder-Narasimha