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-level, cross-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 everywhere, you don't have to care about the interactions with the operating systems, and low-level stuff, programming languages like java handles that for you.
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 Compiler. The java compiler transforms java code into an intermediate low-level code known as Bytecode. This intermediate code is interpreted into a running application by using 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.
The following command line interprets the Bytecode into a running application.
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
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
the program now prints