Java Hello world example

Step 1:

        Open a notepad or any text editor and type the below program

public class Sample 
	public static void main(String[] args) 

		System.out.println("Welcome to");



Save the file as (class

Step 2

        Open a new cmd prompt and locate the java file where it is saved.

compile using javac, you can see a .class file generated in the same loacation

Run using java Sample (java classname)

Related Post