SLC S22 Week1 || Getting Started with Java and Eclipse
3 comments
Write a detailed explanation of the differences between JDK, JRE, and JVM by including their roles, functionalities, and interdependence.
Without wasting much of your time here, let's take a quick look at a detailed explanation of the differences between JDK, JRE, and JVM with their roles, functionalities, and interdependence.
JDK Role
JDK stands for Java development kit which is known as a software development environment or better an application that developers use to develop applications that have to do with Java. Java applications are what JDK is been used for as it provides developers/programmers with the right tools for writing, testing, debugging, and running Java applications (programs).
Functionalities:
JDK is capable of converting source code that is Java into bytecode since its compiler support javac
. Also, many tools like Javadoc, java
, and jdb
which are used for development are contained in JDK. Finally, the incorporation of JRE
allows programmers to execute Java programs during the development stage and as well compilation stage.
Interdependence:
The largest programming environment is JDK which has a well comprehensive components such as JVM and JRE making JDK interdependent from others as most developers use it to write and compile their Java programs.
JRE Role
JRE stands for java runtime environment which provides java programs the environment to run smoothly. JRE is a subset of JDK and its primary aim is to provide end users the means of executing Java applications.
Functionality
Java class libraries and other supporting files that are important for the execution of Java programs are contained in JRE. Development tools like debugger and compiler aren't included in JRE and finally, this JVM is responsible for executing the compiled bytecode of JRE.
Interdependence
Java programs cannot be created using JRE but can be executed using JRE. Also, JRE relies on JVM within it to translate bytecode into machine code for easy understanding.
JVM Role
JVM stands for Java virtual machine which is responsible for running Java bytecode. Also, JVM provides an independent platform for the execution of a program.
Functionalities:
With the process of just-in-time compilation java bytecode is converted into machine code. Also, JVM takes care of memory management, and finally, it provides a more secure runtime environment for bytecode validation and checks.
Interdependence:
JVM is the core component that ensures that Java is written once and run anywhere. Also, it operates within the JRE to execute bytecode which without JVM, JRE cannot function properly.
Above, is a graphic illustration that covers the points.
Install and Set Up Your Java Development Environment and provide step-by-step screenshots of the installation process and Eclipse configuration.
Installing JDK
- To download JDK I visit Oracle's Website
- On the official website I click on Windows since I am using Windows I then follow the instructions for my 64-bit operating system and install JDK.
- After successfully downloading, I open and install the JDK which I click on Next and Next again and allow it to be installed.
Installing Eclipse IDE
- To download and Install Eclipse I visit Eclipse Website
- I click on download "download package and select
windows|x86-64|AArch64
and allow it to install successfully.
- After successfully downloading, I open and install the Eclipse which I click on Launch and follow the process and install it successfully.
Write a program that calculates and displays the sum of the first 100 integers. Define the main method in a class named Sum to handle the entire calculation.
Here I will be showing you the program that calculates and displays the sum of the first 100 integers. In creating the program below, I open the eclipse and create a folder which I named Joseph I then right-click on the folder name select new, and save the file name as Sum.java
. The calculation is done directly within the main
method which you can see below.
In creating the sum2.java
I follow the same procedure as I did previously in the sum. In this program of yh Sum2.java
the calculation logic is encapsulated in a different method which is the calculateSum
that improves the reusability and modularity of the code which you can see below.
Translate, Complete, and Debug the Following Program Named
Tax.java:
**
Here I have created a debugger version of the Tax.java
program that is well complete. The program incorporates the tax bracket and calculates figures based on the provided information given by the professor in his table which you can see how it works below.
The final result (output) for the program is Tax 5550.0
Using the same program structure as in the previous exercise, write a program named Conversion.java that takes a character c as a parameter and:
Here I have run the same program structure as in the previous exercise, in which the program is named conversipn.java
. In the program, there is a method that takes a single character as a parameter. In the program, if c
is a lowercase letter it will be converted to an uppercase letter using Character. to uppercase (C)
which the message will then be displayed as you can see below.
Using a similar structure as in the previous exercises, write a program named ArrayOperations.java that performs operations on an integer array. The program should:
- Take an array of integers as input.
- Provide the following options for operations:
Here in this program as you can see the ArrayOperations.java
program that we have created performs an integer array. As seen below the array is empty, and the message will be displayed and returned but it is not it will iterate through the array to find and print the largest element as seen in the first gif photo.
As seen below the array is empty, and it displays a message and returns.
I am inviting; @dove11, @simonmwigwe, and @lhorgic
Cc:
@kouba01
Comments