Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Java Exercises — a learning journal

I'm a professional cook retraining as a software developer. This repository is my Java learning journal: every exercise I work through, kept in the order I wrote it — including the mistakes.

How this repo works

Everything lives in src/Main.java as one long file. Each exercise is a complete class Main; finished ones are commented out, the one I'm currently working on is live at the bottom. It reads top-to-bottom as a timeline: BMI calculator → food-cost calculator (my day job leaking in) → loops → accumulation → primality → perfect numbers → algorithmic complexity.

The comments are deliberately heavy and mostly in Italian — they're my study notes, written to teach myself why something works, not just what it does. Where I fixed a real bug I left a BUG STORICO comment marking what was wrong, because remembering the mistake is half the lesson.

What I've learned so far (the honest version)

  • Format specifiers, control flow, accumulation patterns — the basics, each annotated.
  • Input validation — and that a while (!scanner.hasNextLong()) loop without scanner.next() inside is an infinite loop, which I learned the loud way.
  • Work variables vs result variables in nested loops — what must reset each iteration and what must survive all of them.
  • Algorithmic complexity, the hard way: my perfect-number search ran fine on small ranges, then I pointed it at 1–150,000,000 and it would have taken ~3 months to finish. Same code, same correctness — wrong curve. Rewriting the divisor sum from O(n) to O(√n) per candidate (divisors come in pairs) brought it to minutes. The compiler catches undeclared variables; nothing catches n². That lesson is now permanently in the comments.

Context

I learn with Claude as a tutor: it explains, I type the code in myself, and it reviews what I wrote. My main project — an Android app for professional kitchens, built the same way — is ChefPro Kitchen Suite.

— Andrea Petrucci (apetrucci90@gmail.com)

About

My Java learning journal, kept honest: from a first BMI calculator to algorithmic complexity, with the real bugs left in and labelled.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages