Welcome to the Java Programs repository! This project serves as a comprehensive collection of fundamental and intermediate Java concepts. It contains neatly categorized examples ranging from basic syntax up to object-oriented programming (OOP) principles.
This repository is perfect for beginners who want to refresh their knowledge of Java or step into programming with practical, easy-to-understand examples.
This repository is organized into specific directories, each focusing on a fundamental Java topic:
Contains beginner-friendly introductory programs to understand the fundamentals of Java syntax, data types, and simple class design.
- Programs include calculating the area of simple shapes (
area.java), swapping variables (swap.java), simple summation (sum.java), and intro to class structures (Student.class,intro.java).
Contains programs demonstrating arrays in Java.
- Includes concepts like reversing an array (
ReverseArray.java), finding odd numbers (OddArray.java), and basic array manipulation.
Focuses on iterative/looping constructs in Java (for, while, do-while).
- Great logic-building examples like finding the HCF/LCM of numbers (
hcf_lcm.java), checking for Palindromes (Palindrome.java), counting occurrences (Count.java), and a simple Calculator (Calculator.java).
Demonstrates basic Object-Oriented Programming (OOP) concepts related to Inheritance.
- Includes class relationship examples showing how child classes inherit properties and methods from parent classes (
inheritance.java).
Shows polymorphism principles, specifically method overloading. Note that there are also several good logic programs integrated here showing overloaded use cases.
- Examples include prime checking (
Prime.java,primerange.java), overloaded sum of 2 numbers (sumof2nos.java), and more dynamic logic structures.
Demonstrates the use of Interfaces in Java for achieving abstraction and multiple inheritance.
- Features a comprehensive
BankingSystem.javaandinterface1.javademonstrating how classes implement interfaces to define specific behaviors.
Focuses on String classes and their manipulation.
- Includes string-driven logical classes like
Bank.javaand other practical string operations (prg15.java,prg16.java).
All source code files are written in standard Java (.java files).
- Clone the repository:
git clone <repository-url>
- Navigate into a specific folder, for instance, Strings:
cd "JAVA PROGRAMS"/String
- Compile the Java file using
javac:(Note: This creates ajavac Bank.java
.classfile in the same directory, which is the compiled bytecode). - Run the compiled Java class using
java:java Bank
To compile and run these programs natively you will need:
- Java Development Kit (JDK): Make sure JDK is installed on your local machine. You can download it from Oracle or grab an open-source version like Adoptium/Eclipse Temurin.
- An IDE (like IntelliJ IDEA, Eclipse, or Visual Studio Code) for a better development experience, or you can just run them via the command line / terminal.
Happy Coding! Feel free to explore, modify, and experiment with the code.