Java Step by Step
Published: 2020-04-26 21:37:51

Hello my dears. After completing the article to the before one of Java step by step we would move on. Firstly to begin programming we need to install one of the programs that enable us to do this. There are many of them like Jshell, Intij, or Sublime. I prefer more Intij or Sublime but it is up to your personal opinion, which one looks cooler and easier for you to use.
We would like here first to understand what are (Types) that we will use them all the time and understanding the differences will make it easier and logical for the further coming steps.
Types:
Integer: it is a full number without points like 9 or 8  ( almost same Long )
Double: it is a number with the math point    6.5     ( almost same Float)
String: it is one word or some words in-between “ “  like    “hallo” 
( Char is one letter between ‘  ‘ )
Why should we know the differences between those types cause logically if I ask you to add a number to a text, you will ask how it can be if both are different.
Exactly with the same logic works the computer. The computer can do a complicated process that takes a long time from our minds to solve but works in the same logic of ours, simply because it is a human being invention. It was made up of our logic as well, yes faster and more accurate but still with our logic.
So when I tell it. Int A    it will open a small place in the memory under the name A as Integer, so the computer expects that sooner or later in this place I will put an Integer in it and the process will be done later will be too up to this type that I defined before, Imagine boxes that you organize your things in to save them in the basement. Organized people will give a name labeled on these boxes as tools for example, other boxes as winter clothes..etc.
So what will happen if you mix?... You won’t find them fast later right? .well computers are very organized too. So you want the same number in a place to be used later for some processes, the computer will ask ok what kind of things you want to put inside then he will ask ok what should I label it then you have the place saved. So when I say  String question
It will understand ok you want to same String and label it as a question, but the box is empty now I want to fill with something, so I say
question=” why you left the work early? ” now he will put this sentence there
so when I want to see what question was here I just ask him to show me this by
System.out.println(question); Then automatically I will see (Why you left the work earlier?)Now same for Integer, try this
Int A
A=3
Int B
B=5
System.out.Println(A+B)
He will give 8 So what happened here I asked him firstly to open 2 boxes which I will save inside only Integers and I labeled these boxes, then I asked the computer to add both together. He did this for me and gave me the results.
But there is too a simple way to do this. I don’t open the box then later I load the tools .. I just want to make both together in one step. I say
Int A=3
Int B=5
System.out.println(A+B)
He will give the same result using only 3 lines.
Now those numbers are changeable and the names as well but the type won't.
As we said the computer is very organized so it has many shelves in is basement in where it put these boxes so it puts integers in one place while it keeps Strings in others for example. It can change the label on the box or what is inside the box but can’t carry the box to another place. So I can say A=7
I changed the 3 to be 7 now if I recalculate it will give me different result from before, I can say too A=C  So now it will throw away the label A and but C but still what inside the same. So if we try to understand it like so it will make the following steps easier. Now let's take some math logics, we know what those signs in math mean ( +,-,*,/) we used them a lot at school but this % would be a new one for us. This sign means if I divide a number on another number what will remain For example 6%3 it will say 0 when 6/3 will give 2 So it means 6/3 accept to be divided on without any remains. To make it easier let's assume you have 7 oranges and 2 children. I want to know if I want to give both of them equal numbers of full oranges how many oranges will be left by me? Answer each child will take 2 and 1 orange will be left by me. We need to know some expressions to be used later as well.
Types=> each value has a type==>String Integer double
Values => data or information =>”hello”   1    0.565
Variables=>a way to point to some data( values) and have a name so we can easily manipulate it=>          double years=30     String color=”pink”
Expressions==> a series of operations that we do on variables or values=>System.out.println(“hello”)
How to get all of this an easier way .. as we said before let’s imagine the computer has a basement with many shelves or rooms ..each room is for a certain type the value is the things inside the box variable is still the tools inside the box but connected to the name of this box and the type so I can change the tools/values whenever I want or to make some process on it. expression is the process itself that is going to give us a product.
Example 1 Euro = 1.09 USD  how can you calculate 100 euro equals how much in USD sure you can use the calculator or even by looking it will be 109 USD ok but imagine you are in a bank or so you need to do this in huge numbers .. the rate may change too ..you need something that does that for you and make it easier.
double Euro=1.09
double amount=100.0
System.out.println(Euro*amount)
So all you need here is to feed up the rate and the amount
Double ==> is the type
Value=> 1.09   or 100
Variable==> double Euro=1.09
Expression=> System.out.println(Euro*amount)
We can even make it with a sentences System.out.println(“the amount is “ + (Euro*amount) + “ USD”) It will give you this result The amount is 109 USD
In Intij or Sublim don’t forget (;) at the end of each line of yours ..try the examples by yourself till the next article.