Java Mastery 150 Problem Set (With Sample Outputs)
LEVEL 1: Basics & Flow Control (40 Problems)
Problem 1: Print "Hello, World!"
Sample Output:
Hello, World!
Problem 2: Add Two Numbers
Sample Output:
Input: 5 7
Output: 12
Problem 3: Check Even or Odd
Sample Output:
Input: 6
Output: Even
Problem 4: Find Largest of Two Numbers
Sample Output:
Input: 7 4
Output: 7 is larger
... (remaining basic problems here)
LEVEL 2: Patterns (20 Problems)
Problem 41: Print Solid Rectangle (4x5)
Sample Output:
*****
*****
*****
*****
Problem 42: Print Hollow Rectangle (4x5)
Sample Output:
*****
* *
* *
*****
Problem 43: Right Angled Triangle
Sample Output:
**
***
****
... (remaining pattern problems here)
LEVEL 3: Arrays & Matrices (25 Problems)
Problem 61: Find Largest Element in Array
Sample Output:
Input: [3, 8, 2, 9, 5]
Output: 9
... (remaining array problems here)
LEVEL 4: Strings (20 Problems)
Problem 86: Reverse a String
Sample Output:
Input: hello
Output: olleh
... (remaining string problems here)
LEVEL 5: Functions & Recursion (10 Problems)
Problem 106: Factorial using Recursion
Sample Output:
Input: 5
Output: 120
... (remaining recursion problems here)
LEVEL 6: OOP Concepts (15 Problems)
Problem 116: Create Student Class with Grade Calculation
Sample Output:
Input: Marks: 75
Output: Grade: A
... (remaining OOP problems here)
LEVEL 7: Collections & File I/O (10 Problems)
Problem 131: Word Frequency using HashMap
Sample Output:
Input: hello world hello
Output:
hello: 2
world: 1
... (remaining file handling problems here)
LEVEL 8: Logical & Real-World Mini Apps (10 Problems)
Problem 141: ATM Simulation
Sample Output:
1. Check Balance
2. Deposit
3. Withdraw
Select Option: 1
Balance: 5000
... (remaining logical problems here)
NOTE:
- Each problem includes full sample output.
- Expand sections daily.
- Hints shared separately if needed.
End of Problem List Outline