Skip to main content

Newbie to Newbie- Intro to Java

 

Newbie to Newbie- Intro to Java

As much as I love coffee, unfortunately this is not about coffee or great drink recommendations to request from your barista. We are going to learn a bit about Java and object-oriented programming. So grab your favorite coffee, frappe, or speciality drink and let's get into it.


Object-oriented programming refers to languages that use objects in programming, they use objects as a primary source to implement what is to happen in the code. Java is a widely used object-oriented programming language and software platform that runs on billions of devices. 

There are 4 major principles of object-oriented programming: encapsulation, data abstraction, polymorphism, and inheritance.

  • Encapsulation is the hiding of data implementation by restricting access to accessors and mutators. To understand encapsulation, let’s talk about what accessors and mutators are. Accessors are methods used to ask an object about itself and mutators allow the users to set or mutate the value of private variables of a class object. It limits access to a class's attribute data and implementation details. The best example of this is a capsule since the medicine is condensed within the capsule. 
  • Data abstraction is used to hide the low-level details of the programming simplifying and streamlining the development process. The best way to think of data abstraction is using a key to turn on your car without knowing the details on how the engine started running.
  • Polymorphism allows a specific routine to use variables of different types at different times which allows a field, in this case, an object, to be changed from one form to another. An example of this is how a woman can be a mother, wife, employee, and student and acts differently in each situation. Polymorphism is essentially the ability to exist in many forms.
  • Inheritance allows deriving of a class from another class or a hierarchy of classes that share a set of attributes and methods. It means inheritance allows classes to inherit common properties from the parent class. For example, a car inherits it properties from vehicles. 

Let’s look at how to install Java and and IDE from a data abstraction point of view (in other words at a high level without too many details.

  • We will need to locate the Java SE Development Kit (JDK) and install it. I found this resource to be the easiest since it provide the kits based on operating sytem: Java JDK Installation
  • Next you will need an editor or integrated development environment (IDE). I ended up choosing NetBeans (NetBeans Download) since this resource made it easy to follow the steps provided to install and run the program: How to Install NetBeans on Mac or How To Install NetBeans IDE on WindowsBoth of these great resources will also provide you step by step on how to run your first program called Hello World. Successfully following the tutorial provided should give you the basics to the program to which you can change and add your name like I did below.



Comments