JAVA Introduction

JAVA was developed by Sun Microsystems Inc in 1991, later acquired by Oracle Corporation. It was developed by James Gosling and Patrick Naughton. It is a simple programming language. Writing, compiling and debugging a program is easy in java. It helps to create modular programs and reusable code.

Features Of JAVA

  • Compiler(javac) converts source code (.java file) to the byte code(.class file). As mentioned above, JVM executes the bytecode produced by compiler. This byte code can run on any platform such as Windows, Linux, Mac OS etc. Which means a program that is compiled on windows can run on Linux and vice-versa. Each operating system has different JVM, however the output they produce after execution of bytecode is same across all operating systems. That is why we call java as platform independent language.
  • Object oriented programming is a way of organizing programs as collection of objects, each of which represents an instance of a class.
  • It is the concept of carrying the instruction from one system to another system.In C Language .c file contain source code and in C++ Language .cpp file contain source code, we can edit also this code. .exe file contain application, only we can execute this file. When we write and compile any C / C++ program on window operating system that program easily run on other window based system.
  • Java is considered as one of simple language because it does not have complex features like Operator overloading, Multiple inheritance, pointers and Explicit memory allocation.
  • Robust means reliable. Java programming language is developed in a way that puts a lot of emphasis on early checking for possible errors, that’s why java compiler is able to detect errors that are not easy to detect in other programming languages. The main features of java that makes it robust are garbage collection, Exception Handling and memory allocation.
  • We don’t have pointers and we cannot access out of bound arrays (you get ArrayIndexOutOfBoundsException if you try to do so) in java. That’s why several security flaws like stack corruption or buffer overflow is impossible to exploit in Java.
  • Using java programming language we can create distributed applications. RMI(Remote Method Invocation) and EJB(Enterprise Java Beans) are used for creating distributed applications in java. In simple words: The java programs can be distributed on more than one systems that are connected to each other using internet connection. Objects on one JVM (java virtual machine) can execute procedures on a remote JVM.
  • Java supports multithreading. Multithreading is a Java feature that allows concurrent execution of two or more parts of a program for maximum utilisation of CPU.
  • As discussed above, java code that is written on one machine can run on another machine. The platform independent byte code can be carried to any platform for execution that makes java code portable.

Common Uses Of JAVA

The uses of JAVA are:

  • Programs created in Java offer portability in a network. Source code is compiled into what Java calls bytecode, which can run anywhere in a network, on a server or on a client that has a Java virtual machine (JVM). The JVM interprets the bytecode into code that will run on computer hardware. In contrast, most programming languages, such as COBOL or C++, will compile code into a binary file. Binary files are platform-specific, so a program written for an Intel-based Windows machine cannot on run a Mac, a Linux-based device or an IBM mainframe. As an alternative to interpreting one bytecode instruction at a time, the JVM includes an optional just-in-time (JIT) compiler which dynamically compiles bytecode into executable code. In many cases, the dynamic JIT compilation is faster than the virtual machine interpretation.
  • An object is made up of data as fields or attributes and code as procedures or methods. An object can be a part of a class of objects to inherit code common to the class. Objects can be thought of as "nouns" that a user can relate to "verbs." A method is the object's capabilities or behaviors. Because Java’s design was influenced by C++, Java was mainly built as an object-orientated language. Java also uses an automatic garbage collector to manage object lifecycles. A programmer will create objects, but the automatic garbage collector will recover memory once the object is no longer in use. However, memory leaks may occur when an object which is no longer being used is stored in a container.
  • C / C++ implements algorithms and data structures swiftly, facilitating faster computations in programs. This has enabled the use of C / C++ in applications requiring higher degrees of calculations like MATLAB and Mathematica.
  • The code is robust. Unlike programs written in C++, Java objects contain no references to data external to themselves or other known objects. This ensures that an instruction cannot include the address of data stored in another application or in the operating system itself, either of which would cause the program and perhaps the operating system to terminate or crash. The JVM makes a number of checks on each object to ensure integrity.
  • Data is secure. Unlike C++, Java does not use pointers, which can be unsecured. Data converted to bytecode by Java is also not readable to humans. Additionally, Java will run programs inside a sandbox to prevent changes from unknown sources.

Course Detail

We cover in this course:

Module 1


Module 2