Ismail qouiqa 28 Oct 2018

What is Java?

Over the past decade, Java has been one of the most well-known and used programming languages in the software industry, mainly because of its various qualities that empower the developer to focus on the application's business value and free him from the complexity related to the Runtime environment.

Java is considered as a high-levelcross-platform, and object-oriented programming language.

High-level programming languages are often made to ease the programming process by abstracting all the low-level interactions between the operating system and the application ( e.g. memory management, network communication), it may use natural language elements (e.g. if, else), and consequently, make the process of developing a program simpler and more understandable than when using a low-level language.

A cross-platform programming language is a language that when compiled, runs everywhere, whatever the circumstances. The slogan is to write it once, run everywhereyou don't have to care about the interactions with the operating systems, and low-level stuff, programming languages like java handles that for you.

Being object-oriented means that developing with Java involves the definition of multiple blueprints known as ClassesThese are used by the running program to spawn elements called Objects that will interact with one another as cells in biology to respond to a particular need and hence we'll end up with a world of objects Interacting with each other.
This phenomenon of spawning objects is known as Instantiation and it is responsible for allocating fragments of the memory for the running application during its life cycle.

Well, In the next posts, we are going to explore different aspects of java, and as a reader, you need to have some background in computer science and a little bit of mathematical logic.

Hello, world!

The purpose of a hello world program is to give an insight into how code is magically transformed into a simple program printing a "hello world" message. The following code written in java is an example of the hello world program.

This code is composed of a java Class representing a structure that contains the entry point for the java platform to execute the main code. this entry point is a function often called the Main function.

First and foremost, to be able to run that code, you need to compile it with the Java CompilerThe java compiler transforms java code into an intermediate low-level code known as BytecodeThis intermediate code is interpreted into a running application by using the java Runtime Interpreter.

  • Javac is the java compiler tool. 
  • Java is the java runtime interpreter.

These tools can be found in the JDK that stands for Java Development Kit. The JDK contains a set of tools used for java development, execution, and debugging purposes. it can be downloaded from the official site of oracle. 

here is the command that compiles the previous code and generates a HelloWorld.class file containing the byte code

  • javac HelloWorld.java

The following command line interprets the Bytecode into a running application.

  • java HelloWorld

Don't forget to remove the extension .class from the filename in front of the interpreter and to be in the directory of the bytecode file before executing the command.

The output should be

  • Hello, world!

Sometimes, your program awaits for arguments to be passed to it.
Note that in most modern IDEs, you won't need to type those commands manually, instead, you will just have to configure your IDE with the appropriate JDK and compile and run your application 
conveniently through buttons.

Arguments are passed to the program as follows 

  • java HelloWorld Ismail

the program now prints 

  • Hello Ismail

Contents