Two ways to Execute Java Program
- Command Prompt
- Integrated Development Environment (IDE)
Using Command Prompt :
1. Let us create a file with Simple Java Program code
//Create a Class
public class sample {
// Add Main Method - Java will Start the Execution from Main Method
public static void main(String[] args) {
// Add Print Statement
System.out.println("Welcome to Learn More");
}
}
2. Save the file with extension of ".java" ( File name should be same as class name )
4. Click on file Path and Enter the keyword of "cmd". Once Click on Enter, Command Prompt will be open along with your file path
6. Execute the program with the help of "java sample" command, then click enter
- IDE is a software application which is used to develop, debug and manage applications.
- It consists of at least program code editor, compiler and debugger.
- There are many IDE's available for java application development in marketplace.
- Eclipse
- IntelliJ IDEA
- NetBeans
If you want the IDE, Download from official site and Install the Software.
!!! If you are looking more features, IntelliJ is a good choice !!!
1. Once Installed the IntelliJ, Open the IDE ( Name the new project and change its location if required )
2. Select the language, build System and JDK Which is mentioned in above image. then, Click on "Create" Button
3. Create a Class under src/main/java
5. Write the sample program in class file
0 Comments