Skip to main content

Introduction to Java Programming

  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 the subsidiary of Oracle) in the year 1995. James Gosling is known as the father of Java. Firstly, it was called  Greentalk  and the file extension was  .gt . After that, it was called  Oak . Initially Java was designed for small, embedded systems in electronic appliances like set-top boxes. 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(Application Programming Interface), it is called a platform. The principles for creating Java programming were "Simple, Robust, Portable, Platform-independent, Secured, High performance, Multithreaded, Architecture neutral, Object-oriented, Interpreted, and Dynamic". Currently, Java is used in internet programming, mobile devices, g...

Introduction to Java Programming

 

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 the subsidiary of Oracle) in the year 1995. James Gosling is known as the father of Java. Firstly, it was called Greentalk and the file extension was .gt. After that, it was called Oak. Initially Java was designed for small, embedded systems in electronic appliances like set-top boxes.

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(Application Programming Interface), it is called a platform.

The principles for creating Java programming were "Simple, Robust, Portable, Platform-independent, Secured, High performance, Multithreaded, Architecture neutral, Object-oriented, Interpreted, and Dynamic".

Currently, Java is used in internet programming, mobile devices, games, e-business solutions, etc.

Features of Java

The primary objective of Java Programming language creation was to make it portable, simple and secure programming language. The features of Java are also known as Java Buzzwords.

Object-Oriented

Java is an object-oriented programming language. Everything in Java is an object. Object-oriented means we organize our software as a combination of different types of objects that incorporate both data and behavior.

Object-Oriented Programming (OOPs) is a methodology that simplifies software development and maintenance by providing some rules.

Simple

Java is very easy to learn, and its syntax is simple, clean, and easy to understand. According to Sun Microsystem, Java language is a simple programming language because:

  • Java syntax is based on C++.
  • Java has removed so many complicated and rarely-used features such as explicit pointers, operator overloading etc.
  • There is no need to remove unreferenced objects because there is an Automatic Garbage Collection in Java.

Secured

Java is best known for its security. With Java, we can develop virus-free systems. Java is secured because:

  • No explicit pointer
  • Java programs run inside a virtual sandbox.

Java language provides Classloader, bytecode verifier, security manager securities by default. Some security can also be provided by an application developer explicitly through SSL, JAAS, Cryptography, etc.

Platform Independent

Java is platform independent because it is different from other languages like C, C++, etc. which are compiled into platform specific machines while Java is a write once, run anywhere language. A platform is the hardware or software environment in which a program runs.

There are two types of platforms: software-based and hardware-based. The Java platform differs from most other platforms in the sense that it is a software-based platform that runs on top of other hardware-based platforms.

Java code can be executed on multiple platforms, for example, Windows, Linux, Sun Solaris, Mac/OS etc. Java code is compiled by the compiler and converted into bytecode. This bytecode is a platform-independent code because it can be run on multiple platforms, i.e. Write Once and Run Anywhere (WORA).

Robust

The English meaning of Robust is strong. Java is robust because:

  • It uses strong memory management.
  • There is lack of pointers that avoids security problems.
  • Java provides automatic garbage collection which runs on the Java Virtual Machine to get rid of objects which are not being used by a Java application anymore.
  • There are exception handling and the type checking mechanism in Java. All these points make Java robust.

Portable

Java is portable because it facilitates us to carry the Java bytecode to any platform. It doesn't require any implementation.

Architecture-neutral

Java is architecture neutral because there are no implementation dependent features, for example, the size of primitive types is fixed.

In C programming, int data type occupies 2 bytes of memory for 32-bit architecture and 4 bytes of memory for 64-bit architecture. However, it occupies 4 bytes of memory for 32 and 64-bit architecture in Java.

Dynamic

Java is a dynamic language. It supports the dynamic loading of classes. It means classes are loaded on demand. It also supports functions from its native languages, i.e., C and C++.

Java supports dynamic compilation and automatic memory management (garbage collection).

Interpreted

The Java compiler generates byte-codes, rather than native machine code. To actually run a Java program, we use the Java interpreter to execute the compiled byte-codes.

High Performance

Java is faster than other traditional interpreted programming language because Java bytecode is "close" to native code. It is still a little bit slower than a compiled language (e.g. C++). Java is an interpreted language that is why it is slower than compiled languages e.g. C, C++, etc.

Multithreaded

A thread is like a separate program ,executing concurrently. We can write Java programs that deal with many tasks at once by defining multiple threads. The main advantage of multi-threaded is that it doesn't occupy memory for each thread. It shares a common memory area. Threads are important for multi-media, web applications, etc.

Distributed

Java is distributed because it facilitates users to create distributed applications in Java. RMI (Remote Method Invocation) and EJB (Enterprise JavaBeans) are used for creating distributed applications. This feature of Java makes us able to access files by calling the methods from any machine on the internet.

Java Index

First Java Program

Object-Oriented Modeling

Dynamic Modeling

Functional Modeling

Variables, Data Types and Escape Sequences in Java

Literals, Keywords, User Input and Comments in Java 

Operators in Java

Strings and String Methods in Java

Java Conditionals (If-else and Switch-case) Statements

Loops in Java

Break and Continue in Java

Arrays in Java

Methods and Recursion in Java

OOPs Concepts

Getters, Setters and Constructors in Java

Inheritance in Java

Polymorphism in Java

Abstraction in Java

Multiple Inheritance in Java

Encapsulation in Java

Packages in Java

Access Modifiers in Java

Introduction to Multithreading

Multithreading in Java

Errors in Java

Exceptions in Java

Exceptions Handling in Java

File Handling in Java

Collection Framework in Java

Previous

Next

Comments