Java SE Development Kit
Installation and Object-Oriented Programming (OOP) Principles for Newbies Like
Me
Java SE Installation
Before you can begin programming in Java, you must first download and install the latest version of the Java Standard Edition Development Kit (JDK). As of writing this, the latest version is JDK 15.0.1. The download can be found on Oracle’s website here. You will download the executable file (.exe) for the operating system you are running on your computer to run the installer. For assistance in the installation process, please see the YouTube video provided by the channel ProgrammingKnowledge. The video is for the previous version, but the steps are the same for the current version.
Object-Oriented Programming Principles (OOP)
Java is an object-oriented programming
language which focuses on the creation of objects and classes. An object could potentially
be anything from the real world, and in programming language is a representation
of that real-life object in code. The
object is shaped to represent its real-life form by giving it attributes, or
states and behaviors. For example, a power
tool is an object and some of its attributes are the type of tool (drill, saw,
planner, etc), size, brand, power source, speed, etc. The more attributes you
can give an object, the closer it can represent the real object. Classes are used
to group similar objects together and serves as a blueprint to created additional
objects. So, using classes you can create a power tool class with all the above-mentioned
attributes to define numerous objects.
There are four major principles
that are commonly referred to when talking about OOP: inheritance, polymorphism,
abstraction, and encapsulation. Inheritance allows for code reusability by inheriting
all the attributes of the parent object that created it. Polymorphism allows for
operations to be performed differently by modifying the methods used on the
objects. This is done in by either overloading or overriding the method to get
the desired result. Abstraction is used to hide certain details of a class or
object from the rest of the program. This can be used to hide the inner
workings of an object by making some attributes private. This allows objects to
be used within the program without revealing how it works internally. For
example, if I wanted to use a power drill, I don’t need to know how it
internally works to use it. I just need to know how to power it and activate it
by pulling the trigger. By using classes and objects their attributes are tied
together in code and are considered encapsulated. This way if an object is
called into action, the program already knows everything about the object.
Further explanation of these
concepts as well as Java tutorial and example script can be found on the
w3shools.com website.
Comments
Post a Comment