Search

Java Tutorial

Java Tutorial

Java is an object-oriented, class-based, concurrent, secured and general-purpose computer programming language. It is a widely used robust technology.

What is Java ?

Java is a programming language and a platform. Java is a high-level, robust, object-oriented and secure programming language.

Java was developed by Sun Microsystems (which is now a subsidiary of Oracle) in the year 1995. James Gosling is known as the father of Java. Before Java, its name was Oak. Since Oak was already a registered company, so James Gosling and his team changed the name from Oak to Java.

Platform: Any hardware or software environment in which a program runs is known as a platform. Since Java has a runtime environment (JRE) and API, it is called a platform.

Java Example

Let's have a quick look at the Java programming example. A detailed description of the Hello World! example is available below.

public class Main{  

    public static void main(String args[]){  

     System.out.println("Hello, World!");  

    }  

}  

Getting Started

   Before diving into coding, we will need to set up your development environment. Java development typically requires the Java Development Kit (JDK), which includes the Java compiler and other essential tools. You can download the JDK from the official Oracle website and follow the installation instructions for your operating system.

Once we have the JDK installed, you can use a text editor or an Integrated Development Environment (IDE) like IntelliJ IDEA, Eclipse, or NetBeans to write and run your Java code. IDEs provide features such as code completion, debugging, and project management, making them invaluable tools for developers.

Application

According to Sun Microsystems, 3 billion devices run Java. There are various devices where Java is currently used. Some of them are as follows:

1. Desktop Applications such as Acrobat Reader, media player, antivirus, etc.

2. Web Applications such as irctc.co.in, tpointtech.com, etc.

3. Enterprise Applications such as banking applications.

4. Mobile

5. Embedded System

6. Smart Card

7. Robotics

8. Games, etc.

Types of Java Applications

There are the following 4-types of applications that can be created using Java programming:

1) Standalone Application

2) Web Application

3) Enterprise Application

4) Mobile Application

Java Platforms / Editions

There are four platforms or editions of Java:

1) Java SE (Java Standard Edition)

It is a Java programming platform. It includes Java programming APIs such as java.lang, java.io, java.net, java.util, java.sql, java.math etc. It includes core topics like OOPs, String, Regex, Exception, Inner classes, Multithreading, I/O Stream, Networking, AWT, Swing, Reflection, Collection, etc.

2) Java EE (Java Enterprise Edition)

It is an enterprise platform that is mainly used to develop web and enterprise applications. It is built on top of the Java SE platform. It includes topics like Servlet, JSP, Web Services, EJB, JPA, etc.

3) Java ME (Java Micro Edition)

It is a micro platform that is dedicated to mobile applications.

4) JavaFX

It is used to develop rich Internet applications. It uses a lightweight user interface API.

Prerequisite

To learn Java, you must have a basic knowledge of C/C++ programming language.

Why Java Programming named "Java"?

Java is an island in Indonesia where the first coffee was produced (called Java coffee). It is a kind of espresso bean. Java name was chosen by James Gosling while having a cup of coffee nearby his office.

Features of Java



The primary objective of Java programming language creation was to make it portable, simple and secure programming language. Apart from this, there are also some excellent features which play an important role in the popularity of this language. The features of Java are also known as Java buzzwords.


A list of the most important features of the Java language is given below.

1.Simple

2.Object-Oriented

3.Portable

4.Platform independent

5.Secured

6.Robust

7.Architecture neutral

8.Interpreted

9.High Performance

10.Multithreaded

11.Distributed

12.Dynamic

Simple
  • Java is easy to learn, with a syntax that is simple, clean, and easy to understand. According to Sun Microsystems, Java is a simple programming language because:
  • Java syntax is based on C++, making it easier for programmers to learn after C++.
  • Java has eliminated many complex and seldom-used features, such as explicit pointers and operator overloading.
  • There is no need to remove unreferenced objects because Java has Automatic Garbage Collection.

Object-Oriented
  • Java is an object-oriented programming language where everything is an object. Object-oriented programming means that we organize our software as a combination of various types of objects that incorporate both data and behavior.


  • Object-Oriented Programming (OOP) is a methodology that simplifies software development and maintenance by providing specific rules.

The basic concepts of OOP are:

1. Object
2. Class
3. Inheritance
4. Polymorphism
5. Abstraction
6. Encapsulation

Portable
  • Java's portability allows programs to run on various platforms without modification. This is achievable because Java code is compiled into bytecode, which is independent of the underlying hardware and operating system. The JVM on each system interprets this bytecode, ensuring platform compatibility.

This portability makes Java ideal for cross-platform applications, allowing developers to write code once and run it anywhere with a compatible JVM. This key reason contributes to Java's widespread use in enterprise applications, web development, and mobile platforms.