Learn Java in 2121- A Quick Guide To Start Java Programming

The benefits of learning Java Programming in 2121 are nearly endless.

Being one of the most popular, in-demand and human-friendly programming languages in the world, you certainly can’t learn Java and be jobless!

Learn_Java_In_2121


A new year is always an opportunity to make new resolutions but also to make a detailed list of the objectives you will try to work and achieve.

In addition, already experienced developers often set themselves the goal of having a new programming language in their belt to boost their careers.

In this tutorial, we’ll take a deep dive as a beginner of Java programming and come out with some Concepts, Live examples, the Latest features and Better learning resources to Start strong with Java programming in 2121.

If you’re thinking of learning Java and use the power of OOPs concepts, Inheritance, Collections APIs to build something meaningful with some advanced concepts, let me assure you that you’re definitely not planning for ravage.

But before anything else…


Guide To Java 

First comes First- What is Java?

Java is one of the most popular programming languages & is a major choice for Android programming and Mobile app development. Java is a general-purpose, class-object based and nearly* 100% Object-oriented programming language.

Nearly*** is important because, we can create Java programs using something called ‘Primitives’ (for example using: int, char, float and similar variable declarations) which is not recommended by Object oriented guidelines.

Java is beginner friendly programming language. It is enriched with a number of properties:

  • Java coding syntax is similar to C/C++. But it doesn’t provide low-level programming functionalities and features (like- pointers).
  • Easy to learn and its syntax is clear and near to human native language. If you’re already familiar with C++, then it may be way easier for you to start java coding.
  • Platform-independency makes it way more fascinating programming language, which simply means if you’ll write code in a windows machine, you can run the same on Linux or Mac machines.

We’ll see later in this post, How is it possible and what exactly happens behind the scenes?


But, Why to Learn Java?

Let’s have a look at this survey conducted by the community of millions of programmers, None other than : StackOverflow –

StackOverflow Survey shows the importance of learning Java in 2121
Src : The StackOverflow Survey 2020

As per the Stack-Overflow Survey, Java is in Top 2 programming languages Trending all over the world.

Let me clear one thing, In the above report, JavaScript, HTML/CSS and SQL are in the top 3 but these are not core programming languages, they come under sub-categories of programming language family:

Clear your doubts from these tutorials –

1) JavaScript : A scripting language (majorly used for rich interfaces, website & frontend development),

2) HTML/CSS : Markup and Styling languges (used to build structure and design the web-pages),

3) SQL : A Query language used to INSERT / UPDATE / DELETE or fetching data and records from databases like MySQL, Oracle etc.

 

The next 2 are Java and Python, which are the core programming languages. No doubt, these are so close in ranking and absolutely booming in the Tech industry these days.

We’ll learn python in another tutorial. For now, come back to Java in 2121.

Java is an excellent choice for beginners as well as novice professionals because it’s a skill that is in high demand for over 2 decades and will continue its wave in the future for sure.

According to the available data, 88% of the Fortune 500 companies happily use Java, to create their own applications & internal systems such as Employee Dashboard. (Source: https://Glassdoor.co.in)

This is also a financially viable career option when the average Java developer earns an average of $102,514 per year. (Source: https://Indeed.com)

That’s why it’s absolutely worthful to learn Java in 2121.

Let’s have a quick look at- What you’ll be able to develop after learning Java.


Top Use Cases of Java- What Are They?

Java is a versatile programming language and that’s the reason, it’s currently being used in many areas of software and app development.

Learn Java in 2121- Top use of Java

 

Some of the major uses of Java are –

Web Apps : Java, a reliable, high performing and flexible programming language, allows small, mid and large companies to establish robust web apps. JSPs and Servlets (the APIs of Java) help to do it efficiently.

Best examples : Google Docs, Google Sheets, Slides and others.

Helpful software tools : Java is a popular language for over 2 decades and used to build both Open-source as well as Commercial projects and Robust softwares.

Best examples : Media Player, Acrobat Reader, Antiviruses and many others.

Mobile Applications : A number of applications are being designed and developed for mobile devices & tablets. Java Micro Edition (Java ME or J2ME) makes it way easier for Java programmers.

Note: Java is highly compatible with AndroidStudio and Kotlin.

Best examples : Android games use Java as a primary language, Java supports jMonkeyEngine (which is one of the most powerful tools for designing 3-Dimensional games), and similar others.

Enterprise Applications : An enterprise application is a large scale software system which operates in a corporate environment, to satisfy the need of a company or organization, rather than of an individual person.

Java is one of the major choices to develop enterprise applications, and few of its core reasons are- Robustness and Cross-platform supportability.

Note: According to stats provided by Oracle corporations,

“Almost 97% of enterprise applications use Java for development of large-scale software for any platform”.

Best examples: Companies like Naukri.com, Jabong, Google, Myntra, Amazon, Flipkart, Trivago, Pinterest and millions of others are growing and using Java at it’s core.

Other Applications of Java :

It’s being also used to develop-

1) Scientific Applications: Research and Medical science, Space, Aeronautics areas.

2) Embedded Systems: Smart Cards, Sensors, Blu-ray disc players.

3) Big Data Field: Hadoop framework written in Java, Apache’s HBase and Accumulo (an open source software  based on Google’s Bigtable).


Java Features – Basic and Advanced

Java is a well-disciplined programming language. And the Java corporation Team is constantly working to provide more and more features in it.

Here are some of the important and latest Java features:

  • No doubt, it’s one of the easy-to-use and beginner’s friendly languages to learn.
  • Platform-independent technology, which simply means- Although you have written programs in a windows machine, you’ll be able to run it on any other machine (say- macOS / Linux / Windows or other).
  • Using Java, you can build apps by following OOPs principles.
  • It supports multi-threading, using which you can run two independent programs at the same time.
  • In recent versions of Java, it’s syntax is getting shorter and shorter (using Lambda expressions and Functional programming), so that you need not to write boilerplate code anymore.
  • The latest versions of Java is enriched with: Sealed classes, Hidden classes, Pattern Matching for ‘instanceof’, Records any many others.

Complete Java Versions – Till 2021

The first official launch of Java programming language was back in 1995, and the latest release is in Java version 15.0 on 15 september, 2020.

Let’s have a look at all the Java versions till 2121 with it’s release date.

Java Versions Release Dates
JDK Alpha and Beta 1995 (The First Release)
JDK 1.0 23rd Jan 1996
JDK 1.1 19th Feb 1997
J2SE 1.2 8th Dec 1998
J2SE 1.3 8th May 2000
J2SE 1.4 6th Feb 2002
J2SE 5.0 30th Sep 2004
Java SE 6 11th Dec 2006
Java SE 7 28th July 2011
Java SE 8 18th Mar 2014
Java SE 9 21st Sep 2017
Java SE 10 20th Mar 2018
JAVA SE 11 25th Sep 2018
JAVA SE 12 19th Mar 2019
JAVA SE 13 17th Sep 2019
JAVA SE 14 17th Mar 2020
JAVA SE 15 15th Sep 2020 (The Latest Release)

Note***: Consider one thing, the last 5 releases of Java have come in just 2 years or less. Now, it’s crystal clear that Java is not going anywhere in the upcoming time, and Learning java in 2121 would never going to be like ravage for anyone.


Start writing some Code in Java

Now we know, why to learn java? And what are the top use cases or applications of Java in 2121? The foundation is clear, let’s start writing code in java…

Getting started with Java:

Step 1) First you need to download and install Java from https://oracle.com/

Step 2) Configure it according to your computer operating system (macOS / Linux / Windows).

Step 3) Additionally, you can download any of the popular IDEs – Integrated Development Environment (Eclipse, Netbeans, IntelliJ or similar) and link it with your Java Development Kit (JDK).

That will allow you to write, compile, and run your .java files and programs in a single place.

Once you have done that, you are good to go.

3J’s of Java Platform : JDK, JRE and JVM

Most of the programmers know how to start learning Java and start writing code in it, but they don’t have clear cut knowledge on these 3 core concepts/modules of Java Technology & Platform.

These 3 are responsible for all the magic that happens whenever you write a piece of code, and run it to see the output.

You will definitely hear these terminologies while learning java probably more than thousand times, as these are hot topics of most of the technical interviews too.

Let’s have a look and understand the functionality of JVM, JRE and JDK with a simple problem.

Problem: Assume, you’ve got a task to display a message 100 times in unique patterns as the user runs your app.

Here are the overview of steps in which your code gets executed-

Step 1) You’ve written some code in java in a .java file, let’s say PrintSKL.java.

Step 2) Then you saved the code and compiled it (using the compile button of your IDE or the javac fileName command).

 

Here, the JDK is responsible to understand the java code, compile and convert it into an intermediate code- The Byte code ( a JVM understandable language).

Learn Java in 2121- Understand the working of JDK, JVM and JRE
Simple Demonstration: What happens at Runtime in Java?

Step 3) After compilation, a new file, with the same name and .class extension, automatically gets created. The code inside the .class file best known as Byte code.

The code inside the .class file is not understandable by humans, even your computer or operating system can’t read it. It can only be understood by the JVM.

Step 4) Once the .java file compiled successfully having no syntactical errors, you run your program using the ‘Run’ button of your IDE or the ‘java fileName’ command in terminal.

Here is the responsibility of JRE to run your java application.

Step 5) JRE forwards the .class file to the JVM with the necessary libraries that you have used in your code (Input/Output APIs, Collections APIs, Math Libraries, etc).

Now, JVM comes into the picture. It takes the code line-by-line from the byte code, converts it into machine understandable language and passes to the CPU. The CPU then displays the output of your program.

And everything is done !!!

JDK, JRE and JVM in Short:

  • JDK- Java Development Kit,
    JRE- Java Runtime Environment,
    JVM- Java Virtual Machine,
  • JVM is part of JRE and JRE is a part of JDK.
  • JDK = Development tools( softwares for Compiling, Documenting, etc ) + Environment to Run the app,
  • JRE = Only provides the Environment to run Java applications.
  • JVM = Responsible to execute the code (more specifically ‘Byte code’) line-by-line.

That is how the platform compatibility issue gets resolved so easily just because of something known as ‘Bytecode’ and a logical software: JVM- Java Virtual Machine.

Note***: For different-different operating systems (Linux, Windows, etc), Java corporation provides different-different JVMs.

So, the java code that you write is same for different machines and we get the desired results in different machines. That’s why, Java is best known as- a platform-independent programming language.


How do you write “Hello” in Java?

No programming article is worthful unless a clear-cut example is there. So let’s create a Java program to get started now…

Before starting writing code in Java, first you need to download, install and configure it in your Computer / Laptop.
Also you’ll need a Text Editor (eg: Notepad / Notepad++ / Eclipse, or anyone that you like) for Java coding.

Steps to Compile and Run first Java program –

Step 1) Open Editor (let’s say- Notepad++).

Step 2) Write the below example source code in java and Save the file as TheFirstProgram.java

class PrintPrettyLines {
	public static void main( String [ ]theArguments ) {
	      System.out.print("Hey Programmer- Welcome to ShubhamKLogic.com");
}

 

What’s happening here is :

Line 0: Defined a Class with name PrintPrettyLines
Line 1: Defined the main method public static void main (String []theArguments)
Line 2: The System.out.print(“Hey Programmer- Welcome to ShubhamKLogic.com”); It will displays the message that lies between the double quotes i.e.: “Hey Programmer- Welcome to ShubhamKLogic.com”.

Make sure, when you save the file, you must include the extension of .java  at the end of your file name.

Additionally, you can create a separate workspace (or folder/directory) for your Java programs. In our example, we have create a workspace named ‘TheJavaPrograms’ –

Write your program, Compile it and Run it.

Step 3) Open the command prompt. Go to Directory C:\TheJavaPrograms , To compile your Java code, call the Java compiler using command: javac TheFirstProgram.java

If you’ve written the correct code in java, a .class file (also known as Byte code) will be created automatically in the same workspace (or folder/directory).

Step 4) To run or execute the code, enter the command java TheFirstProgram. You will see the desired output.

 

Note*** :

Java is a case sensitive Programming language, which simply means- all code, commands even file names should be in the same case. Capital letters should be in capital letters and small in small. In java, TheFirstProgram is not same as Thefirstprogram.

Step 5) If you are using an IDE like- Eclipse, then just copy-paste and save the file. After saving the source code, as you click the ‘run’ button, the compilation and execution gets done.

One Recommendation***
Using an IDE will definitely improve your efficiency, but since you are learning Java, we recommend you to stick to the simpler one, like: Notepad or Notepad++. This will help you in Learning the syntax of Java and empower you for the long run. Once you feel confident in it, just switch to IDE anytime.

Some Better Resources for you to Learn Java Effectively

Learning a new Technology can be exciting and super easy if you have the Correct tools and Learning resources. Here are a few of them share by our community members on Facebook Page

1) Oracle Official Java Tutorials: Grab all the Latest features and updates of Java programming from their official documentation.

2) CodeGym.cc : Absolutely appropriately named. Probably one of the best places to learn java programming ‘practically’.

3) Head First Java: If you like reading Tech books, Learn simple as well as advanced concepts with this Java book.

4) Coursera: If you are in those programmers, who likes to learn by watching simple yet interesting videos and tutorials, Coursera is for you.


Wrap Up 

The best way to learn anything new in programming is by doing CODE. Constant practice in coding and some patience makes all the differences. How much and how well you do that will decide how quickly you will learn Java or any other technology.

In this beginners friendly article, we’ve learned, What exactly is Java? Why to learn Java? It’s Top features, Latest versions and Releases till today.

Also, we have seen some most confusing terms & hot topics of all level Java interviews i.e. JDK, JRE and JVM (with an example).

Now, It’s your turn:

Don’t be afraid to ask people,
Practice daily and start with small projects,
Join web communities as Sitepoint, our FB page and SKL Group,
And keep an eye on coming updates and technologies,

Learning Java will help you to build a successful career in Web Development, Mobile App Development, and in other similar lines as well. So, keep some patience, practice for at least 2 hours a day and Prepare Core Java Concepts very well.

One Request?

I’ve put so much effort into writing this post to provide value to the programming community. If you found this helpful? Please consider sharing a copy of its Link with social media friends, It’ll be very helpful for all. Thanks!!!

Sharing is Caring conclusion-and-sharing-request


Leave a Comment