Hey Devs!

My Object-Oriented Programming module just launched at uni — and while I’ve seen a fair bit of OOP before, this time I’m diving in properly with Java. Think of it like a revision session… but the kind where the teacher actually checks your work.

This post covers:

  • Java's primitive types and strict typing
  • Input/output with Scanner
  • Type conversion, operators, and the underrated ternary
  • Comparing objects the right way (hello .equals())
  • Some good old conditional structures

No “I’m a total newbie” energy here, just honest reflections from a career-changer who’s been in the code trenches for a while, and still finds joy in learning the fundamentals (again, but better).

Java Primitives: It’s a Family Affair

In Java, primitive types come in families. It’s not just one lonely int out there in the wild, no, there are whole lineages of data types, each with its quirks, limits, and memory footprints. And Java, being the serious language that it is, wants you to declare things properly.
You’ve got options:
Declare it plainly.
Typecast it.
Wrap it up in an object with a wrapper class.

Basically, Java wants commitment. None of that “figure it out later” dynamic typing nonsense.

Input, Output & That Trusty Scanner

So far, I’ve experimented with different ways to display information - clean, formatted, and sometimes just shouting values out into the void. Output’s great, but what really makes it feel like a program is when you can interact with it.
That’s where java.util.Scanner comes in. Suddenly, Java’s listening. Keyboard input? Monitored. Captured. Handled with the type safety of a neurotic bodyguard.
And yes, I built a GUI version of a sum calculator with Swing. Because who doesn’t want to add two numbers with flair, right?

Operators, Math & More

Refreshed my memory on:
Arithmetic operators (+, -, %, the usual suspects)
Unary operators (Java's way of raising a single eyebrow)
Assignment operators (+=, -=, etc)

Then there’s the Math class, Java’s in-built toolkit for square roots, exponents, and generating random numbers (between 0.0 and 1.0).
With a bit of clever math, you can scale those to any range you like, which makes it perfect for anything from dice rolls to secret superhero name generators.

Logic, Relational Thinking & Ternary Muscles

This part took me back to my first steps in this field, the first course I have joined… the logic gates of programming:
&&, ||, !, the Boolean heavyweights.
Comparison operators like >, <, ==, etc.

And then there’s the ternary operator, which always makes me feel like I’ve written clever code even when I’m just comparing two numbers.
larger = n1 > n2 ? n1 : n2;
Clean. Elegant. Looks like I know things.
Also, a quick reminder from Java: comparing objects with == is like asking if two people are the same because they wear the same coat. What you meant to ask was if they have the same name, and for that, you use .equals().

If, Else If, Else Else Else Else Else…

My most recent lessons have been all about conditionals. Nothing groundbreaking here, I’ve seen them before, but Java still finds a way to say, “I know you know this... but do you really?”
You’ve got your if, your else if, your else, and those rare but magical moments when you finally don’t need curly braces. But spoiler: I still use them, because I like sleeping at night.

Final Thoughts

Right now, Java feels like the strict but fair teacher I wish I had in high school, the one that didn’t let you get away with shortcuts but always made sure you understood why things worked the way they did.
A lot of what I’m covering feels familiar, like meeting a concept I knew from another language, but this time it’s speaking Queen’s English and wearing a tie.
There’s still a lot to cover, or review(?). Classes, methods, objects, all the OOP hits are coming, and I’m ready. Well, mostly ready. I’m showing up, taking notes, and occasionally laughing at my own code when it behaves like a teenager with selective hearing.

Where are you in your Java (or OOP) journey? Have you revisited a topic recently that hit different the second time around? Let’s talk.