Introduction to Java programming

This section of the Java programming tutorial covers an introduction to Java Programming Language. Let’s dive quickly into the topic now.

Introduction to Java programming

Sun Microsystems Inc. developed JAVA in 1991, which was later acquired by Oracle Corporation. James Gosling and Patrick Naughton developed it. It’s a simple language for programming. It’s easy to write, compile and debug a program in java. This helps create reusable software and programming that can be recycled.

The Java language has been developed with the following properties:

Platform Independent Programming Language

Java applications use the Java virtual machine as an interface and do not have direct access to the operating system. This renders highly portable Java applications. On all compatible platforms, such as Windows and Linux, a Java application (which is standard-compliant and meets those rules) can run unmodified.

Object-oriented programming language

All components of Java are objects except for the basic data types.

Strongly-typed programming language

Java is strongly-typed, e.g. the types of variables used have to be pre-defined and translation to other objects is relatively strict, e.g. the programmer has to do so in most situations.

Interpreted and compiled language

Java source code is translated to the target application bytecode format. The Java Virtual Machine (JVM) interprets these bytecode instructions. The JVM contains a so-called Hotspot-Compiler which translates performance-critical bytecode instructions into native code instructions.

Automatic storage management

For creating new objects, Java handles memory allocation and de-allocation. The software has no immediate memory control. The so-called garbage collector deletes objects that do not have an active pointer.

Terminology of Java

Let’s get acquainted with common java terminology before we start learning Java.

Java Virtual Machine (JVM)

This is commonly referred to as JVM. Before, we discuss JVM lets have a look at the phases of program execution.

  1. Write code
  2. Compile code.
  3. Run code.

Phases are as follows:

  1. The code is compiled by a java programmer like you and me.
  2. The program is compiled by a javac compiler, javac is the main java compiler included in the software development kit (JDK). As input, it takes java software and produces java bytecode as output.
  3. JVM executes the compiler-generated bytecode in the third phase. This is considered the process of running the program.

So now that we have learned that JVM’s primary function is to execute the compiler-generated bytecode. -operating system has different JVM, but all operating systems have the same performance after bytecode execution. That’s why we call java as a platform-independent.

Java Development Kit(JDK)

I used the word JDK when describing JVM and bytecode. This is a full software development package that contains JRE (Software Runtime Environment), JavaDoc, Java debugger, etc.

The Java Development Kit is an implementation of either Java Platform, Standard Edition, Java Platform, Business Edition, and Java 9, Micro Edition systems published by Oracle Corporation as a binary software for Solaris, Linux, macOS, and Windows Java programmers.

Java Runtime Environment(JRE)

JRE is part of JDK, meaning JDK is part of JRE. You can run a java program if you have JRE built on your machine, but you won’t be able to compile it. JRE includes support for JVM, browser plugins, and applets. You only need JRE if you only need to run a java program on your machine.

Garbage collector

The JVM stores the information that is not referred to by other objects automatically. The Java garbage collector searches all references to objects and identifies objects that can be released automatically.

While the garbage collector relieves the programmer from the need for clear memory management, the programmer also needs to ensure that he does not retain unneeded references to objects, otherwise the garbage collector will not be able to release the corresponding memory. Maintaining unneeded references to objects are typically called memory leaks.

Classpath

The classpath specifies where to load files for the Java compiler and Java runtime. You can use these instructions in the Java application.

For example, you need to add this library to your classpath to use it in your software if you want to use an existing Java library.

Development Process with Java

As plain text documents, Java source files are written. Normally the programmer writes Java source code for programming in an Integrated Development Environment (IDE).

An IDE assists the programmer in writing programming activities, e.g. providing source code auto-formatting, highlighting keywords, etc. At some stage, the programmer (or IDE) calls the Java interpreter (javac). The bytecode instructions were provided by the Java compiler. Such instructions are stored in files of.class and the Java Virtual Machine will execute them.

Leave a Reply

Your email address will not be published. Required fields are marked *

Shopping cart