dankirichok1 / dankirichok1/example2
Code quality improvements for HelloWorld.java
- Dominant language
- Java
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
## Summary
This issue tracks code quality improvements suggested in [PR #1](https://github.com/dankirichok1/example2/pull/1) review comments.
## Suggested Improvements
### 1. Replace repetitive print statements with loop
**Current code (lines 3-7):**
```java
System.out.println("Hello, World!");
System.out.println("Hello, World!");
System.out.println("Hello, World!");
System.out.println("Hello, World!");
System.out.println("Hello, World!");
```
**Suggested improvement:**
```java
for (int i = 0; i < 5; i++) {
System.out.println("Hello, World!");
}
```
### 2. Use descriptive variable names
**Current code (lines 9-12):**
```java
int a = 10;
int b = 20;
int c = a + b;
System.out.println(c);
```
**Suggested improvement:**
```java
int firstNumber = 10;
int secondNumber = 20;
int sum = firstNumber + secondNumber;
System.out.println("Sum: " + sum);
```
### 3. Eliminate code duplication
**Current issue:** Lines 14-17 duplicate the calculation logic from lines 9-12
**Suggested improvement:**
```java
public static void calculateAndPrint(int num1, int num2) {
int result = num1 + num2;
System.out.println("Result: " + result);
}
```
Then call: `calculateAndPrint(10, 20);`
## Benefits
- Improved code maintainability
- Better readability and self-documenting code
- Follows Java best practices
- Reduces code duplication
## Priority
Low - Enhancement for code quality
---
_Related to PR #1 review comments: https://github.com/dankirichok1/example2/pull/1#discussion_r2288884122_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.