SLC S22 Week1 || Getting Started with Java and Eclipse

Black and Red Simple Tips How To Be A Programmer Youtube Thumbnail.png
Designed wwith canva

Greetings steemians, I am very elated to take part in this first course on java by @kouba01, which kicks start with Java and eclipse. I had little knowledge about coding though we were taught about coding basics in my year 1 and 2, which brings alot of awareness in my coding journey. I have come across java several times but not as coding application but as a gaming application.

Write a detailed explanation of the differences between JDK, JRE, and JVM

when talking about all these components, it is important to take a very detailed observation about them as they all work together to make develop an application. now in an expanded view, i will talk about each component, talking about their roles, functionalities and interdependence.

  • JDK (Java Development Kit)
    Have you thought of how users create, compile and run codes on java programs? it is simply through the use of JDK. This kit gives the user an access to a collection of tools which is used to create, compile and run codes on java.
    Functionality; this is what is needed to run and create a java program, it contains all the tools a user needs in creating a program.
    interdependence; the jdk which is sort of the main component depends on JRE, which gives the library needed to run programs, while the JVM is used to execute java bytecodes.

  • JRE (java runtime environment)
    As the name implies it is that environment in which programming is being done, looking at the it as a library off tools needed to run java applications.
    *functionality; the jre loads the data into memory and also executes the bytecode using JVM.
    interdependence; The jre depends on the jvm to execute bytecodes and also on java class loader to load java classes.

  • JVM (java virtual machine)
    this is simply that software program that executes and run a bytecode on a computer.
    functionality the jvm loads java classes to the memory and also executes java bytecode.
    interdependence the jvm simply relies on the java class loader to load java classes to the memory

Graphic illustrations

graphic illustrations.png

Designed with canva

Now, from this illustration it will be very easy for anyone to understand the concept between JDK, JVM and JRE. Let's look at the chef, the cooking utensils, both the chef and the utensils are in the kitchen. now let's look at the customer waiting for the chef, all these are happening in a restaurant.

The chef takes orders from the customer and goes into the kitchen to start preparing, now the chef is the JVM which is work is to execute that data(food) ordered. The kitchen utensil used which contained tools used in preparing the food is the java libraries where the tools needed are stored. The kitchen as a whole where all of this cooking takes place is now the JRE, which is the environment in which the creating and executing of data takes place.

The customer waiting can be the java compiler and other java development tools. The whole hotel where this whole scene takes place is known as the JDK.

Install and Set Up Your Java Development Environment and provide step-by-step screenshots of the installation process, Eclipse configuration.

From the post i was able to access the link to the oracle official website and i was able to download my JDK from the official website.

steem screenshot.png

While the page was done loading i changed from linux to windows as i am using windows and i dowloaded the x64Mi installer

steem 3.pngsteem 4.png

Based on the instructions from my operating system, i went on to the editing environment, went to advanced and then environment variables. i went to the java files down there and i paste the java code i copied from the directory file i downloaded.

steem 2.png

To check if this app was successfully installed in your device, you move to the command prompt by simply searching on the search bar of your windows. and type in java --version which will load the data to show it was successfully installed.

INSTALLING ECLIPSE

this was quite easy as i went to the link given to by our teacher Eclipse

steem 5.pngsteem 7.png

It was quite easy as i had the link to the app already, i went on to downloads and i found the latest version for my windows and i clicked on download which didn't take up to 2 minutes.

steem 10.pngsteem 11.png

After downloads i immediately went on to install, this took close to 4 minutes to install, i had all the patience to wait till it was ready to be used.

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.

  • Save this program in a file named Sum.java, compile it, and execute it.
  • Create a new program named Sum2.java, where the calculation of the sum of the first 100 integers is performed in a separate function called calculateSum. This function should then be called from the main method.
day 8.png

on opening my app, i was able to locate file, i then click on new and the java project. i typed in my project name which is sum as required by the task. i created a class to work in by simply clicking on the project then new and then class, i ticked the public static void main... box and clicked finish.

to get that sum of the numbers, i was able to declare the variable to display the sum of the first 100 integers. when i executed the code i was able to get 5050 which shows that the i=1 which ranges to <=100 and ++ which indicates a maximizing manner.

sum 2.png

dayy 9 (2).png

as reuested, i was able to create another class for sum2.java. The variable to calculate the first 100 integers on a separate function which is the calculatesum function. This makes use of the integer from 100 to calculate the first 100 integers

translate, Complete, and Debug the Following Program Named Tax.java:**

in this task we were given an incomplete task to complete and aslo debug. First thing i did was to create a new project calling it Tax. i created a class for it. the project will require us adding the whole tax which was given in the task.

tax 4.png
The total tax which was gotten from all the three tax was 5050 as concluded by the code.

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:

using the same method i was able to create the project and also code it to make conversions and the result is down below.

correct.png

correction result.png

Using a similar structure as in the previous exercises, write a program named ArrayOperations.java that performs operations on an integer array

i followed the same format to create my array project. using the functions which will handle every operations to be carried out.
first code.png

code 2.png
this gives the numbers in ascending order, the largest element in the array and so on.
code 2-3.png

empty array.png

to get the empty array, i pulled off the numbers there and it gave out the statement

empty array result.png

cc, @kouba01

Coin Marketplace

STEEM 0.24
TRX 0.25
JST 0.040
BTC 94127.71
ETH 3400.37
USDT 1.00
SBD 3.38