Open links in new tab
  1. Java Examples - Programiz

  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 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, …

  4. 35 Basic Java Program Examples with Outputs | Simple Java Program

    • See More

    Oct 30, 2025 · Java Simple Program for Beginners demonstrates the fundamental structure of a Java application, including class declaration, main() method, and basic I/O. It’s the perfect starting point to …

  5. Java Simple GUI - Programming Examples - Online Tutorials Library

    Learn how to play with Simple GUI in Java programming. Here are most commonly used examples−.

  6. 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 …

  7. People also ask
    Loading
    Unable to load answer