In today's lesson you will learn how to use Java to write a line of text to a command prompt. Step One: Open up Notepad or whatever text editor you wish to use.
Step Two: Copy this code into your new text document and then Save it as "HelloWorldApp.java". Keep the same case that I used or it won't work.
Code
class HelloWorldApp { //Defines the new class file (also is the name of the file)
public static void main(String[] args) { //The main method allows it to run.
System.out.println("Hello World!"); // Display the string or line of text.
} // Closes the main method
} // Coses the class
Step Two: Now that you got the code you have that done, open up a new text document and type the following code. Once you are done with that, save it as compile.bat and run the batch file. This will compile your code that you used in Step One into a .class file.
Code
@echo off
javac HelloWorldApp.java
pause
@end
Step Three: Now that you have done that make a new text document and type the following code. Once you are done, save as Run.bat and run that batch file. This will run your program.
Code
@echo off
java HelloWorldApp
pause
@end
Congratulations! You have just made your new Java Simple Program. Leave a reply if you get any errors, I will help you with them gladly.