Tuesday, August 2, 2022

CPT 307 Object - Oriented Programing (OOP's) Java installation

 

https://www.oracle.com/java/technologies/downloads/#jdk18-windows

Beginning with Java installation

Hello fellow Java enthusiasts,

Getting started with Java can seem daunting to the new programmer. I am going to share some resources I used that helped me start on the journey of coding with Java.

            The journey begins with Oracle (2015) explaining Object-Oriented programming concepts at http://docs.oracle.com/javase/tutorial/java/concepts/index.html. They explain objects, class, inheritance, interfaces, and packages in detail. Objects have state and behavior. For example, a car have state (name, color, make, speed) and behavior (Steering, gas pedal, applying brakes). Software objects are similar to real objects. Classes are like thousands of cars of the same make and model with the same blueprints of objects like cars. Inheritance is different kinds of objects like trucks, jeeps, caravans, and standard or automatic. In Java, each class is allowed to have one superclass that has the potential to have unlimited subclasses. The interface is the interaction with the outside by methods formed by objects. You interface with a car by buttons for Cruise control and many more. An interface allows a class to interact with the outside world. A package is like the different folders on your computer of various types. This is how thousands of other classes are organized for ease of use. Now that we know about OOP concepts let's move toward finding and installing Java.

Installing Java

Installing Java involves going to https://www.oracle.com/java/technologies/downloads/

and choosing between Linux, macOS, or Windows downloads. Once downloaded, the website includes instructions for installation, which will help if any complications arise. For example, I installed the download on Windows 10, and for some reason, it did not install to the correct path, and the instructions helped explain how to click on the download again and repair the path link.

Using Notepad++  to create a “Hello World” Java program to run in Power Shell or Command line. (No IDE editor needed).

The tutorial at https://docs.oracle.com/javase/tutorial/getStarted/cupojava/win32.html

explains in great detail how to complete a simple “Hello World” program in Java using Notepad++ downloaded at https://notepad-plus-plus.org/downloads/v8.4.4/

and PowerShell or command terminal to compile and create a .class file and run the .java program. The commands used to compile a class “javac HelloWorldApp.java” and execute “java -cp . HelloWorldApp” were the commands I used, except I made a HelloMynameApp.java and HelloMynameApp.class files which made the program more personal.

Example of java file and class file.


IDE installation

Downloading an IDE like Virtual Studio Code at https://code.visualstudio.com/download, Eclipse at https://www.eclipse.org/ or other platforms is an easy way to create and execute in the editor that automatically compiles the Java file and runs on a terminal in the editor. Instructions are on the websites and explain the many features available. Eclipse has a cheat sheet included when you open the application to create the Hello World Application. Virtual Studio Code can implement multiple programming languages and is an IDE platform I utilize.

Open Eclipse IDE to begin the tutorial for Hello world.


                                                               Hello World Application

There are numerous ways to make your first Java program, and Hello World is the best place to start. Oracle gives you the exact code at: https://docs.oracle.com/javase/tutorial/getStarted/cupojava/win32.html that you can copy and paste directly into your choice of editor. Best of luck creating your first program in Java!

 

 

References

Oracle. (2015). Lesson: Object-oriented programming concepts (Links to an external site.). Retrieved from http://docs.oracle.com/javase/tutorial/java/concepts/index.html

Tutorials Point (Links to an external site.). (https://www.tutorialspoint.com/java/)

Eclipse https://www.eclipse.org/

VSC https://code.visualstudio.com/download

Notepad++ https://notepad-plus-plus.org/downloads/v8.4.4/


CPT 307 Week 5 Newbie to Newbie

Applying algorithmic design and data structure techniques creating structured programs   https://www.prepbytes.com/summer-programs/master-...