So here is our first Java Helloworld 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