Base Java Part 1
Tags: beginners, tutorial, java
Published: 2019-12-23 13:54:15

This is a series covering Java basics, which hopefully help a beginner to get up and running.

In this part1 tutorial, we will cover

1. What is Java?
2. Differences between JDK, JRE, and JVM.
3. Features of Java.
4. First Java program.

Here is the full video of the part 1 Base Java Series. Please show some love and subscribe to my channel [HERE](https://www.youtube.com/channel/UCBRX8VfhAp7FJ_13uzpI_pQ?sub_confirmation=1).

{% youtube p7t4K1EDx-s %}

***Why Java?***
Because Java is still among the most popular and most used programming languages because of its scalability and community. It is still the 3rd most language on Github and the 5th most popular language according to StackOverflow 2019 survey.

![Github Octoverse](https://thepracticaldev.s3.amazonaws.com/i/lfr30elm0k3cifi6urcp.png)

![StackOverflow Survey](https://thepracticaldev.s3.amazonaws.com/i/f20cpsowb7eyrcue5r2n.png)

***What is Java?***
Java is a general-purpose programming language that is class-based, object-oriented, and designed to have as few implementation dependencies as possible. It is intended to let application developers write once, run anywhere (WORA), we will get deep into it later.

***History of Java***
Java was developed by sun microsystems, James Gosling is known as the father of Java, The first version of Java JDK (Java Development Kit) was first released in 1995, the latest version at the time of recording is Java SE 13 released September 2019.

***Difference between JDK, JRE, JVM***

***JDK (Java Development Kit):*** JDK is the one you need to build applications in Java, it contains everything that is required to build and run Java applications. When you download java from the oracle site to develop applications you actually download JDK, which comes with JRE and the following Devtools,
1. ***JavaC:*** Java Compiler which compiles your Java code. 
2. ***Java:*** Interpreter/loader which reads your java code. 
3. ***JavaDoc:*** This helps in generating java documentation for your code.

***JRE (Java Runtime Environment):*** JRE contains everything to run the java application, it contains code libraries required to develop java applications. JRE contains the Java class libraries, the Java class loader, and the Java Virtual Machine. In this system: The class loader is responsible for correctly loading classes and connecting them with the core Java class libraries. The JVM is responsible is to ensure Java applications have the resources they need to run and perform well in your device or cloud environment. The JRE is an orchestrator between these components.

***JVM (Java Virtual Machine):*** JVM is machine-specific and can only read byte code that has been generated using java compiler.  Once the java compiler compiles the code to byte code, JVM is the one which reads it and runs on that machine, you might have heard that Java is portable, this is what it meant the compiled byte code can be run on any machine with the help of JVM.

![JDK vs JRE vs JVM](https://thepracticaldev.s3.amazonaws.com/i/zudx9rtqx1gdzx8umlpf.png)

You might have seen the below image saying Java is being run on 3 billion devices, it actually means JVM is running on 3 billion devices.

![Java 3Billion](https://thepracticaldev.s3.amazonaws.com/i/h49azi1o0m2xm4qmrbgq.png)

***Features of Java***

There are many features that led Java to be one of the most popular languages for over 2 decades. These are the features of Java.


![Java Features](https://thepracticaldev.s3.amazonaws.com/i/orkddw8v4sj1koe4xrve.png)

***Object-Oriented***

Everything in Java is Object Oriented. We organize our software as a combination of different types of objects that incorporates both data and behavior.

***Simple***

Java syntax is very simple and easy to learn. The syntax is based on C++ but removed unnecessary and complicated stuff.

***Platform Independent***

Java language is platform-independent, you write once and run anywhere (WORA). When you compile java file with Javac it generates .class file which can run on any machine by installing the JVM on that machine.

![Platform Independent.](https://thepracticaldev.s3.amazonaws.com/i/27qp65gtzyg10ocotomy.png)

***Secured***

Java is best known for its security, you can build virus free software, it runs inside a virtual machine sandbox, unlike C++ runs on an OS, it doesn't have pointers like C++ which allows it write more secure code.

***Multi-Threaded***

Java multi-threaded features allow the application to run multiple processes concurrently. A process can be divided into multiple threads and can be run on all the threads simultaneously which makes the whole operation faster.  

![Java Multi Threaded](https://thepracticaldev.s3.amazonaws.com/i/vwi3jtndvlwo0nt5jwx1.png)

***High Performance***

Java is faster than traditional interpreted languages, as its byte code is closed to the native code. Java uses ***JIT (Just in Time)*** Compilers, which enables for high performance.

***Dynamic***

Supports dynamic loading of classes. Holds excessive amount of run time info, that can be used to access objects during runtime. You don't have to instantiate all the objects at the initialization, you can instantiate the objects when required at the runtime.

Here is the full video of the part 1 Base Java Series.  Please show some love and [SUBSCRIBE](https://www.youtube.com/channel/UCBRX8VfhAp7FJ_13uzpI_pQ?sub_confirmation=1) to my channel [HERE](https://www.youtube.com/channel/UCBRX8VfhAp7FJ_13uzpI_pQ?sub_confirmation=1).

{% youtube p7t4K1EDx-s %}


In the next part, we will cover Java Variable, Java Datatypes, Operators and Keywords, etc...