Java Programming Tutorials — Source Code Examples, Arrays, GUI and Core Java Concepts

Flat isometric illustration of a monitor displaying Java code with coffee cup icon GUI window frame and class inheritance diagram in blue

Java remains one of the most widely used programming languages in the world — taught in universities, used in enterprise systems, and powering billions of devices through the Java Virtual Machine. Its write-once-run-anywhere philosophy, strong object-oriented foundation and rich standard library make it a first-choice language for students learning programming fundamentals and professionals building scalable enterprise applications.

MYCPLUS has been publishing Java programming tutorials and source code examples since 2004. This section covers Java from the ground up — starting with core language fundamentals and progressing through practical topics including arrays and data structures, graphical user interface development with Java Swing and AWT, object-oriented design patterns and real-world application examples you can compile and run immediately.

With over 45 articles covering beginner through advanced Java concepts, you will find clear explanations of Java syntax and core programming principles, practical source code examples for common programming challenges, and hands-on GUI tutorials that show how to build interactive Java applications from scratch. Whether you are a student working through your first Java course, a developer brushing up on fundamentals, or a programmer transitioning from C++ or Python — this section gives you the practical Java resources you need.

What You’ll Learn:

  • Core Java fundamentals — variables, data types, control flow, methods, constructors and the foundational Java programming model explained with practical examples
  • Arrays and data structures in Java — single and multi-dimensional arrays, ArrayList, LinkedList, stacks, queues and practical data structure implementations in Java
  • Object-oriented programming in Java — classes, inheritance, polymorphism, interfaces, abstract classes and encapsulation with real-world Java source code examples
  • Java GUI development — building graphical user interfaces with Java Swing and AWT, event handling, layout managers, buttons, forms and interactive application design
  • Java collections and generics — working with the Java Collections Framework, iterators, generics, Maps and Sets for efficient data management in Java applications
  • Practical Java source code — ready-to-compile Java programs covering algorithms, sorting, searching, file handling and common programming challenges for hands-on learning

Why MYCPLUS: Trusted by Java developers and students since 2004 — every tutorial includes working source code you can compile and run immediately, with clear explanations designed for real-world Java programming skills.

Java Programming Questions

What is Java Programming Language? The Java programming language is a high-level language that can be characterized by all of

Simple Image Viewer in Java with Swing

Simple Image Viewer in Java with Swing

This Java program is a simple image viewer application designed for novice Java programmers. The program utilizes the Swing library to create a graphical user interface (GUI) with a JFrame, JPanel, and JButton components. The main functionality of the Java program is to select an image file through a JFileChooser dialog, load the selected image and display it within the JPanel.

Blackjack Java Game Challenge

Blackjack Java Game Challenge

The Blackjack game written in Java provides a graphical user interface (GUI) for players to enjoy a simplified version of the classic card game. Upon starting the game, players are dealt an initial set of two cards each, and the goal is to build a hand with a total value as close to 21 as possible without exceeding it. The game features a deck of standard playing cards, including numbered cards, face cards (King, Queen, Jack), and Aces, each contributing their respective values to the hand.

astrological_sign

Ouputs the Zodiac signs

The following Java program shows the Zodiac sign corresponding to a given date. This little program can be used to find your Zodiac sign if you input your date of birth.

Java Code to Demonstrate Recursion

The Java code implements a simple graphical application that visually represents and counts blobs within a grid by using recursion. A blob is a group of adjacent filled squares in the grid. The application uses Java Swing for creating the graphical user interface (GUI) components. It includes buttons for generating a new set of blobs, counting the number of blobs, and a grid where users can click to get information about the blob size at that specific position. This Java code uses recursion in the getBlobSize method to calculate the size of a blob.

Java - Set Different Borders of a Label

Java Source Code: Create Different Borders of a Label

This is a Java source code for a simple graphical application that demonstrates how to use various types of borders in Swing, a Java GUI toolkit. The program defines a class BorderDemo that extends JApplet, a Swing component used for embedding a Java application in a web page or other container.

Java Program to Draw Star Shapes

This Java program creates a simple graphical application that draws rows of stars using Java’s Swing library. The program creates a window with rows of stars drawn on it. The Star class defines the shape of a star, the StarPane class handles the drawing logic, and the StarApplet class sets up the main frame for the application. This example showcases basic GUI programming with Swing.

Scroll to Top