Commit deaabf0
committed
feat(Phone): add simple Phone class with brand and model fields
What
- Introduced `Phone` class with:
• Two fields: `brand` and `model`.
• Constructor to initialize both fields.
• Overridden `toString()` method for readable object representation.
Why
- Provides a minimal data model to represent phone objects.
- Useful as a building block for demos, collections, or further feature expansions.
How
- Inputs:
- `brand` (String), `model` (String) passed to constructor.
- Outputs:
- `toString()` returns formatted string: Phone{brand='...', model='...'}.
- Flow:
1. Instantiate Phone with brand and model.
2. Use `toString()` when printing/logging.
- Complexity:
- O(1) for construction and string rendering.
Real-life applications
- Can be used in inventory systems, e-commerce product catalogs, or mobile databases.
- Acts as a simple DTO (Data Transfer Object) in APIs.
Notes
- Class is minimal and does not include equals/hashCode (not needed for this simple demo).
- Can be extended later with price, year, specs, etc.
Signed-off-by: https://github.com/Someshdiwan <[email protected]>1 parent e949956 commit deaabf0
File tree
1 file changed
+19
-0
lines changed- Section 25 Collections Frameworks/Map Interface/Garbage Collection/src
1 file changed
+19
-0
lines changedLines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
0 commit comments