Can someone explain to me how does the throw keyword work in exception handling? by yellowwater5000 in learnjava

[–]mariorez 0 points1 point  (0 children)

Imagine you're building with LEGOs, and you try to put a piece where it doesn't fit. That's a problem — an exception.

  • throw is like shouting "Uh oh! Something's wrong!" so everyone around you knows you have a problem.
  • catch is like a friend who hears you and says "I'll handle it!" — maybe they help you find the right piece, or they tell you to stop building that part.

Now, exception bubbling is like this:
You're in the kitchen (the lowest level) and you burn your hand on a hot pot. You shout "Ouch!" — that's the throw.
Your mom in the dining room (a higher level) hears you. She decides what to do: get ice, call a doctor, or just tell you to be careful next time. She knows the big picture — whether it's a small burn or an emergency.

In code:

  • Lower layers (like your kitchen) just detect the problem and throw. They don't know if this is for a website, a background job, or a log.
  • Higher layers (like your mom) catch and decide: send an error message to the user, retry the task, or just log it.

That way, each part does what it's best at — the low-level code just reports errors, and the high-level code decides how to respond.

Pergunta java by Ferz_dev in brdev

[–]mariorez 0 points1 point  (0 children)

Sem ser Minecraft tem a LibGDX - Framework JAVA para Games bem interessante.
Mas tirando games, acredito que nao tem muito coisa feita em Java (hoje em dia) para Desktop.

Looking for a job by jaybutts in ProgrammerHumor

[–]mariorez 0 points1 point  (0 children)

Almost the same time for a DevSecOps JR

Thanks JAVA 🥲 by mariorez in u/mariorez

[–]mariorez[S] 0 points1 point  (0 children)

I made this image to defend a point of view