Introduction to Java
Introduction to Java
Java is a high-level, class-based, object-oriented programming language.
A general-purpose programming language made for developers to Write Once Run Anywhere(WORA) that is compiled Java code can run on all platforms such as Windows, Mac OS, and the various versions of UNIX.
History
JAVA was developed by James Gosling at Sun Microsystems in the year 1991, later acquired by Oracle Corporation.
The history of Java starts with the Green Team. Java team members (also known as Green Team), initiated this project to develop a language for digital devices such as set-top boxes, televisions, etc. Currently, Java is used in internet programming, mobile devices, games, e-business solutions, etc.
Following are given significant points that describe the history of Java:
1) James Gosling, Mike Sheridan, and Patrick Naughton initiated the Java language project in June 1991. The small team of sun engineers called Green Team. Initially it was designed for small, embedded systems in electronic appliances like set-top boxes.
2) Firstly, it was called "Greentalk" by James Gosling,
3) After that, it was called Oak and was developed as a part of the Green project.
4) In 1995, Oak was renamed as "Java" because it was already a trademark by Oak Technologies. 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.
5) Initially developed by James Gosling at Sun Microsystems (which is now a subsidiary of Oracle Corporation) and released in 1995.
JAVA is used for:
Mobile applications (specially Android apps)
Desktop applications
Web applications
Web servers and application servers
Games
Database connection
And much, much more!
Java technology is both a programming language and a platform.
Features of Java
The features of Java are also known as Java buzzwords. A list of the most important features of the Java language is given below.
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++ (so easier for programmers to learn it after C++).
Java has removed many complicated and rarely-used features, for example, pointers, operator overloading, multiple inheritances, and explicit memory allocation, etc.
There is no need to remove unreferenced objects because there is an Automatic Garbage Collection in Java.
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.
Basic concepts of OOPs are:
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 and Run Anywhere (WORA) 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.
Java is a software-based platform that runs on top of other hardware-based platforms. It has two components:
Runtime Environment
API(Application Programming Interface)
Java compiler converts the source code into an intermediate code called the bytecode and this byte code is further translated to machine-dependent form by JVM (Java Virtual Machine).
Each operating system has a different JVM, but the output produced by all the OS is the same after the execution of bytecode. That is why we call java a platform-independent language.
Portable
As we know, java code written on one machine can be run on another machine.
The platform-independent feature of java in which its platform-independent bytecode can be taken to any platform for execution makes java portable.
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 machine
Java does not allow programmers to explicitly create pointers. As, we don’t have pointers, so we cannot access out-of-bound arrays i.e. it shows ArrayIndexOutOfBound Exception if we try to do so.
Java programs run in an environment that is independent of the operating system environment which makes java programs more secure.
It has a bytecode verifier that checks the code fragments for any illegal code that violates the access right.
Classloader: Classloader in Java is a part of the Java Runtime Environment (JRE) which is used to load Java classes into the Java Virtual Machine dynamically. It adds security by separating the package for the classes of the local file system from those that are imported from network sources.
Security manager – determines what resources a class can access such as reading and writing to the local disk.
Robust
Java is robust because:
It uses strong memory management.
There is a 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.
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 both 32 and 64-bit architectures in Java.
Compiled and Interpreted
Java offers both compilation and interpretation of programs. It combines the power of compiled languages and the flexibility of interpreted languages.
When a Java program is created, the Java compiler (javac) compiles the java source code into byte code. The Java Virtual Machine (JVM) serves as an interpreter that converts byte code to machine code which is portable and can be executed on any operating system.
High Performance
Java offers high performance as it used the JIT (Just In Time) compiler. The compiler only compiles that method which is being called. The JIT enhances the performance of interpreting byte code by caching interpretations.
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-threading 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
We can create distributed applications using the java programming language. Remote Method Invocation (RMI) and Enterprise Java Beans (EJB) are used for creating distributed applications in java. The java programs can be easily distributed on one or more systems that are connected to each other through an internet connection.
Dynamic
Java being completely object-oriented gives us the flexibility to add classes, new methods to existing classes and even creating new classes through sub-classes. Java even supports functions written in other languages such as C, C++ which are referred to as native methods.
Comments
Post a Comment