My first Java Blog


Part I

For me, OOP is a method of structuring software that models it around objects rather than actions. 

How? Let's first understand the basic foundations of it!


Object:

Think of an object as something you use daily, like a smartphone. In programming, an object combines data (like battery level, and apps installed) and actions (such as making calls or sending messages). This approach keeps the object's data safe and lets it perform its tasks effectively.

Class:

A class is like a recipe. It tells the computer what an object should have and what it can do. For example, a class for a bicycle would include instructions for creating bicycles, specifying features like speed and how to change gears.

Inheritance:

Inheritance is a way to create a new class using an existing class as a foundation. It's like how you might inherit your eye colour or height from your parents. This means you can create a specialized version of a class (like a mountain bike class from a general bicycle class), automatically including all the features of the original.

Interface:

An interface is like a contract that outlines specific actions a class must implement. Think of it as a list of promises. If a class signs up to these promises, it must fulfill them, such as a bicycle agreeing to have a working brake system.

Abstraction:

Abstraction is about focusing on what's necessary and hiding the rest, much like using any household appliance. Take a microwave, for example—you don’t need to know all the details about how it heats food. Instead, you just need to know how to operate it using the buttons on the panel. In programming, abstraction allows you to interact with objects, like clicking a button to save a file, without knowing the detailed code that makes it work.

Polymorphism:

Polymorphism means "many shapes". It’s like speaking different languages depending on who you’re talking to. For instance, the way you greet someone might change based on the language they speak as “Hello” in English or “Assalam o Alaikum” in Arabic. In programming, polymorphism lets the same method or function behave differently depending on the object it’s interacting with. For example, a draw() method might display a circle, a square, or a triangle depending on the shape object it’s called on.

These concepts can be applied to a lot of real-life problems as through them we can set up the strong foundations of any good application. 


Part II

Setting Up Java Enviroment 

To get started with Java programming, you'll need to install the Java Development Kit (JDK). I found a really helpful guide on freeCodeCamp that walks you through the installation process step-by-step, which is perfect for beginners.

Link to the article: https://www.freecodecamp.org/news/how-to-set-up-java-development-environment-a-comprehensive-guide/

Once you have installed Java, a fun way to test everything out is by creating your very first program. A simple "Hello, World!" program is the classic first step. It's a quick and easy way to see your new Java setup in action.

Comments