B.Tech Students: Apply for Live Programming Internship C, C++, Java, Python ,Web page Designing, PHP First Java Program | TutorialsApp

Java First Program

This is the basic structure of a Java program. Let's understand step-by-step how to write and run it using Eclipse, VS Code, or JDK + Text Editor like EditPlus.

यह एक साधारण Java प्रोग्राम है। चलिए इसे Eclipse, VS Code, या JDK + Text Editor जैसे EditPlus में step-by-step लिखना और चलाना सीखते हैं।

Download Resources / डाउनलोड करें

Step-by-Step: Run in Eclipse or VS Code

  1. Open your IDE (Eclipse or VS Code).
  2. Create a new Java project (e.g., "MyFirstProject").
  3. Create a new Java class file named HelloWorld.java.
  4. Copy the following code into the class file.
  5. Save the file and click Run or press F5 / Ctrl+F11.
  6. You will see the output window showing: Hello, World!
  1. अपने IDE (Eclipse या VS Code) को खोलें।
  2. नया Java प्रोजेक्ट बनाएं (जैसे "MyFirstProject")।
  3. HelloWorld.java नाम से नया Java क्लास फाइल बनाएं।
  4. निम्नलिखित कोड को क्लास फाइल में कॉपी करें।
  5. फाइल को सेव करें और Run पर क्लिक करें या F5 / Ctrl+F11 दबाएं।
  6. आपको output विंडो में Hello, World! दिखेगा।

Step-by-Step: Run Using JDK + Text Editor (EditPlus)

  1. Install the latest JDK and set up the PATH environment variable.
  2. Open EditPlus (or any text editor).
  3. Create a new file and write your Java program below.


  4. Save the file as HelloWorld.java (class name must match).
  5. Open Command Prompt (Windows) or Terminal (Mac/Linux), and navigate to the file location.



  6. Compile the Java file with the command: javac HelloWorld.java
  7. Run the compiled program with the command: java HelloWorld
  8. You will see the output: Hello, World!
  1. सबसे पहले JDK डाउनलोड और इंस्टॉल करें और PATH सेटअप करें।
  2. EditPlus (या कोई भी text editor) खोलें।
  3. नई फाइल बनाएं और नीचे दिया गया Java कोड लिखें।
  4. फाइल को HelloWorld.java नाम से सेव करें (class का नाम वही होना चाहिए)।
  5. Command Prompt (Windows) या Terminal (Mac/Linux) खोलें और फाइल के फोल्डर में जाएं।
  6. Java फाइल को कंपाइल करें: javac HelloWorld.java
  7. प्रोग्राम चलाएं: java HelloWorld
  8. आउटपुट में Hello, World! दिखाई देगा।

Java Program Code

public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}
Output:
Hello, World!

Explanation (English):

  • public class HelloWorld: Defines a class named HelloWorld.
  • main(): The entry point method where execution starts.
  • System.out.println(): Prints text to the console.
  • The program prints Hello, World! and ends.

व्याख्या (Hindi):

  • public class HelloWorld: HelloWorld नाम की एक class बनाता है।
  • main(): मुख्य method है जहाँ प्रोग्राम शुरू होता है।
  • System.out.println(): स्क्रीन पर text print करता है।
  • प्रोग्राम Hello, World! print करके खत्म होता है।