Newbie to Newbie Blog- Part One

 




Hello Newbie,

Let’s talk about Object-oriented Programming and Java. The four principles are encapsulation, abstraction, inheritance, and polymorphism. But before we get into that let’s discuss some programming concepts first.

According to https://docs.oracle.com/javase/tutorial/java/concepts/index.html

The following concepts provide an introduction of the syntax in Java programming.

What Is an Object?

An object is a software bundle of related state and behavior. Software objects are often used to model the real-world objects that you find in everyday life. A real-world example might be a pen, chair, table, computer, etc.

What Is a Class?

A class is a blueprint or prototype from which objects are created. A simple class can cleanly model state and behavior. 

What Is Inheritance?

An interface is a contract between a class and the outside world. When a class implements an interface, it promises to provide the behavior published by that interface.

What Is a Package?

A package is a namespace for organizing classes and interfaces in a logical manner. Placing your code into packages makes large software projects easier to manage.

Next let’s define the four main principles of OOP.

I retrieved these definitions from the following resource. https://medium.com/@cancerian0684/what-are-four-basic-principles-of-object-oriented-programming-645af8b43727 

Encapsulation

Encapsulation is the mechanism of hiding of data implementation by restricting access to public methods. Instance variables are kept private and accessor methods are made public to achieve this.

Abstraction

Abstract means a concept which is not associated with any instance. Using abstract class/Interface we express the intent of the class rather than the actual implementation.

Inheritance

Inheritances expresses “is-a” and/or “has-a” relationship between two objects. Using Inheritance, in derived classes we can reuse the code of existing super classes.

Polymorphism

It means one name many forms. It is further of two types — static and dynamic. Static polymorphism is achieved using method overloading and dynamic polymorphism using method overriding. It is closely related to inheritance. We can write a code that works on the superclass, and it will work with any subclass type as well.

Now that we have a brief understanding about object-oriented programming (OOP) and Java let’s talk about how to install Java on a Windows system. If you are like me and this is your first attempt at installing Java, you won't be able to do it without installing the Java Development Kit, or JDK.

This is where I made my first mistake. The JDK contains the Java Runtime Environment (or JRE) which is the core of a Java program. It is important to install the correct version so that it is compatible with an IDE. I chose NetBeans for my IDE; without JDK the IDE will not work properly, and you will receive an error after it is downloaded.

You can download the official JDK directly from the Oracle website.: https://www.oracle.com/.

In addition, you can you use the following resource for step-by-step directions for installation. I found it to be very useful.

https://www.freecodecamp.org/news/how-to-install-java-on-windows/

After you have completed the Java installation you can then download the IDE of your choice.

As mentioned, I chose NetBeans. If you’d like to use NetBeans, their download can be accessed at https://netbeans.apache.org/download/nb16/

After you have a basic understanding of the concepts of OOP and have successfully installed the programs you need, you are now ready to program using Java.

My first program project was called Hello Word.

If you want to try it yourself, here is another excellent resource with step-by-step instructions for "Hello World!" for the NetBeans IDE.

https://docs.oracle.com/javase/tutorial/getStarted/cupojava/netbeans.html

Here is a sample of my result:

 

Comments

Popular posts from this blog

Post #7 – Tech Topic Connection