This repository is part of the Java Basics Training Program (Days 1–2).
It is designed to help you practice both Java fundamentals and professional Git/GitHub workflows.
You will practice:
- Variables and data types
- Operators
if–elseconditions- Loops
- Arrays
- Methods
- Branching
- Committing
- Pushing changes
- Creating Pull Requests (PRs)
- Working on shared repositories
- Isolated development using branches
- Code review via Pull Requests
Each participant will:
- Work on one assigned exercise
- Create a separate Git branch
- Add one Java class
- Push the solution to GitHub
- Raise a Pull Request (PR) to
main
After PRs are merged, everyone will pull from main to get all solutions from the batch.
By completing this exercise, you will learn to:
- Write clean, readable Java code with proper comments
- Structure Java classes correctly
- Use Git branches for isolated development
- Push changes to GitHub
- Create and review Pull Requests
- Sync your local code with the team using
git pull
✅ This mirrors real-world professional workflows.
java-basics-batch-exercises/
├── README.md
├── pom.xml
└── src/
└── main/
└── java/
└── com/
└── batch/
└── exercises/
👉 All Java exercise classes must be created inside:
src/main/java/com/batch/exercises/
Do not create Java files outside this package.
- One participant = one exercise
- One exercise = one Java class
- Do NOT modify other students’ files
- Do NOT modify
pom.xmlor project structure - Do NOT push directly to
main - All work must be done in your own branch
- Code must compile
⚠️ Violating these rules may result in PR rejection.
Create your branch using the following format:
<firstname>-ex<NN>
vishal-ex03
anita-ex11
rahul-ex07
Each exercise must be implemented as a new Java class.
ExerciseNN_ProblemName.java
Exercise03_FizzBuzzPlus.java Exercise10_RotateArray.java Exercise17_GradeClassification.java
Every Java class must start with a header comment:
/**
* Exercise NN: <Exercise Title>
*
* Problem Statement:
* Clearly describe the problem here.
*
* Approach:
* Brief explanation of the logic used.
*/- Use inline comments only where logic is non-obvious
- Avoid unnecessary comments such as "this is a loop"
- Each class must include a main method:
public static void main(String[] args) {
// demonstrate the solution with sample input/output
}- You may Use hardcoded inputs (preferred)
- Use Scanner only if required by the problem
git clone <repo-url>
cd java-basics-batch-exercises
git switch -c <firstname>-ex<NN>
git switch main
git pull
git switch <your-branch>
Navigate to:
src/main/java/com/batch/exercises/
Create only one Java file Follow naming and comment rules strictly
git status
git add .
git commit -m "Add solution for Exercise NN: <Problem Name>"
git push -u origin <your-branch>
On GitHub:
Base branch: main
Compare branch: <your-branch>
PR Title
Exercise NN – <Your Name>
PR Description Must Include
Brief explanation of your approach
Sample output (copy-paste from console)
Everyone must sync:
git switch main
git pull
This ensures you have all solutions from the batch.
PRs will be reviewed for:
- Correctness
- Code clarity
- Proper comments
- Git discipline
Feedback may be added directly to PRs. Treat PR reviews as learning opportunities, not evaluations.