This repository contains a collection of Java programs that demonstrate fundamental concepts in the Java programming language. It's intended for beginners who are learning Java and want to explore basic syntax, data types, operators, and other core features.
- ArithmeticExpressions.java: Examples demonstrating different arithmetic operations and how to construct arithmetic expressions in Java.
- Array.java: Shows how to declare, initialize, and manipulate single-dimensional arrays in Java.
- Casting.java: Illustrates explicit and implicit type casting between different primitive data types.
- ComparisonOperator.java: Examples of using comparison operators to compare values in Java.
- Constants.java: Demonstrates how to declare and use constant variables in Java using the
final
keyword. - Escape_Sequences.java: Provides examples of using escape sequences in strings for special characters.
- FormattingNumbers.java: Explores ways to format numbers (e.g., currency, percentages) for output.
- IfStatements.java: Examples of using if statements to execute code based on a condition in Java.
- LogicalOperators.java: Examples of using logical operators to combine multiple conditions in Java.
- Main.java: This is a basic main method file that contains simple code.
- MathOperation.java: Illustrates commonly used math functions provided by the Java standard library.
- MultiDimensionArray.java: Shows how to create and work with multi-dimensional arrays.
- OrderOfOperations.java: Demonstrates the precedence of operators in Java expressions.
- Pri_Vs_Ref.java: Compares primitive data types with reference types, specifically focusing on their way of storing data and variable assignation.
- Primitive_Types.java: Examples of using all of the primitive data types, explaining their ranges, sizes, and default values.
- ReadInput.java: Shows how to read input from the user using the
Scanner
class. - Reference_Type.java: Explains the core of reference type, such as object initialization and object type variables.
- Simplifying_IF_Statements.java: Examples of simplifying if statements using logical operators and ternary operators.
- Strings.java: Examples of how to create, compare, and manipulate Strings using the String class.
- TernaryOperator.java: Examples of using the ternary operator to write concise conditional expressions in Java.
- Variable.java: Demonstrates how to declare and use variables with different data types.
-
Clone the repository:
git clone https://github.com/TajwarSaiyeed/programming-with-java
-
Navigate to the project directory:
cd HelloWorld
-
Compile Java files:
javac src/*.java
-
Run the programs:
To run a program, such as
ReadInput.java
, execute:java src/ReadInput
-
Quick Testing:
If you'd like to test a code snippet quickly without setting up a local environment, you can use an online Java compiler such as Online Java Compiler.
- Each file focuses on a specific concept to ensure clarity and easy understanding.
- Comments are included in each file to explain the code and logic.
If you find any errors, or have suggestions for improvements, feel free to submit an issue or pull request.
This project is licensed under the MIT License - see the LICENSE
file for details.