Open links in new tab
    • Work Report
    • Email
    • Rewrite
    • Speech
    • Title Generator
    • Smart Reply
    • Poem
    • Essay
    • Joke
    • Instagram Post
    • X Post
    • Facebook Post
    • Story
    • Cover Letter
    • Resume
    • Job Description
    • Recommendation Letter
    • Resignation Letter
    • Invitation Letter
    • Greeting Message
    • Try more templates
  1. Java is a versatile and widely-used programming language, known for its simplicity and portability. Practicing Java programming through examples is an effective way to learn and master the language. Here are some common Java programming examples that cover basic to advanced concepts.

    Basic Java Programs

    1. Hello World Program

    The simplest Java program that prints "Hello, World!" to the console.

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

    2. Add Two Numbers

    A program to add two integers.

    import java.util.Scanner;

    public class AddTwoNumbers {
    public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    System.out.print("Enter first number: ");
    int num1 = scanner.nextInt();
    System.out.print("Enter second number: ");
    int num2 = scanner.nextInt();
    int sum = num1 + num2;
    System.out.println("Sum: " + sum);
    }
    }
    Copied!

    3. Check Even or Odd

    A program to check whether a number is even or odd.

    Feedback
  2. Java Programs - Java Programming Examples

    Sep 25, 2025 · This page covers Java programming examples from basics like Fibonacci, Prime numbers, Factorials and Palindromes to advanced topics such …

  3. Java Examples - W3Schools

    Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP, Bootstrap, Java, XML and more.

  4. Java Programs – 500+ Simple & Basic Programs With …

    Feb 25, 2026 · Java programs: Basic Java programs with examples & outputs. Here we covered over the list of 500+ Java simple programs for beginners to advance, …

  5. Java Program Examples - Tutorial Gateway

    For all these simple and basic Java programs, we provide multiple examples (ways to find the solution) using for loop, while loop, do while, recursion, functions, and …

  6. 100+ Java Programs for Practice

    Whether you are preparing for Java exams, coding interviews, competitive programming, or improving your core programming skills, these Java practice …

  7. 50 simple java programs for beginners | Java …

    Mar 26, 2021 · Can you write a program to check whether a number is prime number or not? Ans. Check for all the numbers below the given number that any …

  8. 35 Basic Java Program Examples with Outputs | Simple …

    Oct 30, 2025 · Java Simple Program for Beginners demonstrates the fundamental structure of a Java application, including class declaration, main() method, and …

  9. Java Programs – Java Programming Examples with Output

    Nov 28, 2022 · This page includes java programs on various java topics such as control statements, loops, classes & objects, functions, arrays etc. All the programs are tested and provided with the output.

  10. Java Programs (Code Examples With Output)

    New to Java? Kickstart your learning with simple Java programs, step-by-step examples, clear output, and beginner-friendly explanations.