Sitemap
2 min readApr 20, 2025

--

Java and the Mystery of Adding Numbers (Yes, It's Fun!)

Hey there, fellow coders and curious minds!
Today, I explored something super basic but still exciting adding numbers in java.

Now I know what you’re thinking…
"Just addition? That’s too easy!"

Press enter or click to view image in full size
The AT&T 10 digit big number desk calculator - a friend to accountants everywhere (and people who can't remember their times tables)
Photo by Ben Wicks on Unsplash

But when Java is involved, even a simple add operation turns into a mini adventure especially if you’re learning one semicolon at a time, like me!

Let’s Start with Two Numbers

So I sat down and told Java:

"Hey Java, I have two numbers. Can you add them for me?"

And Java replied:

"Sure, but you gotta speak my language first."

So I gave this:

int a = 10; int b = 20; System.out.println(a + b);

Boom! Output: 30

I was like, “Wow! I’m officially a Java magician!”

But What If I Add Three Numbers?

Then I got brave and said…

"Okay Java, how about THREE numbers?"

Java: "Bring it on!"

Get Alwinabrisha’s stories in your inbox

Join Medium for free to get updates from this writer.

And here's what I wrote:

int a = 10, b = 20, c = 30; System.out.println(a + b + c);

Output: 60!

Easy-peasy!

A Quick Tip: Watch the Errors!

But hey — forget just one semicolon or mismatch a data type, and Java goes like:

"ERROR ALERT! I don’t know what you’re saying!"

So remember:

  • Use the right data types
  • Don’t forget ; at the end
  • And always check your spelling — Java doesn’t do guesswork!

The Takeaway?

Even something as simple as addition can teach us:

  • How to write clean code
  • How Java reads our inputs
  • And how it loves structure

So don’t skip the “easy” stuff.
The real magic begins right there.

Thanks for reading my Java journey — one line, one smile, one output at a time.
If you’ve ever fought with Java over an addition error, we’re officially coding besties!

Stay tuned for more beginner-friendly fun blogs
Because learning Java can be simple — and full of laughter!

Want to See My Code?

I built a small Java project called Student Info App that uses variables and data types — just like I explained above!

Check it out on GitHub here:
GitHub – Student Info App

github link: [https://github.com/alwinabrisha/Student-Info-app]

#JavaJourney #CodeWithAlwina #StudentInfoApp #LearnAndBuild

--

--