Featured post

Magento® 2.x How to create basic frontend module

How to create basic frontend module in Magneto 2 ?? Step 1. Decide a name space(Extendtree) & module name(Helloworld). Ex. Extendtre...

Saturday, 3 September 2016

First Java Program (Hello World) : Compile and Run

So here is our first Java Helloworld program:

public class Helloworld { public static void main(String args[]) { System.out.println("Hello World..!! This is my first java Program"); } }

Compile & Execute a java program:

Step 1: Create a Helloworld.java file & put the above code in it. (File name should match with class name)

Step 2: Open CMD (I assume Java is already setup in yours system. if not see the previous post.)

Step 3: Save file Helloworld.java in some location Ex. A:\Akhil\Myjavaprograms\Helloworld

Step 4: Open CMD and go to your java file directory

Step 5. Now compile your java program by using command Javac Helloworld.java . This will create a Helloworld.class .

Step 6: Now use command Java Helloworld . To Run your first Java program.


Note: Once class file is generated then command Java Helloworld use class file only to run the program.

No comments :

Post a Comment