Call Us at: 8056 966 366 / 9500 960 135
Mail us at: info@cloudcareersolutions.com

INTRODUCTION JAVA

Java is an object-oriented, cross platform, multi-purpose programming language produced by Sun Microsystems. First released in 1995, it was developed to be a machine independent web technology. It was based on C and C++ syntax to make it easy for programmers from those communities to learn. Since then, it has earned a prominent place in the world of computer programming.

Java has many characteristics that have contributed to its popularity:

  • Platform independence – Many languages are compatible with only one platform. Java was specifically designed so that it would run on any computer, regardless if it was running Windows, Linux, Mac, Unix or any of the other operating systems.
  • Simple and easy to use – Java’s creators tried to design it so code could be written efficiently and easily.
  • Multi-functional – Java can produce many applications from command-line programs to applets to Swing windows (basically, sophisticated graphical user interfaces).

Java does have some drawbacks. Since it has automated garbage collection, it can tend to use more memory than other similar languages. There are often implementation differences on different platforms, which have led to Java being described as a “write once, test everywhere” system. Lastly, since it uses an abstract “virtual machine”, a generic Java program doesn’t have access to the Native API’s on a system directly. None of these issues are fatal, but it can mean that Java isn’t an appropriate choice for a particular piece of software.

The Java Platforme

One thing that distinguished Java from some other languages is its ability to run the same compiled code across multiple operating systems.

In other languages, the source code (code that is written by the programmer), is compiled by a compiler into an executable file. This file is in machine language, and is intended for a single operating system/processor combination, so the programmer would have to re-compile the program seperately for each new operating system/processor combination.

Inside the Magic

The “Hello World” program has become a de-facto standard with computer programmers for a first program in any language. The main advantage is that it is as simple as a program can get – when considering what it does. Depending upon the language and/or environment though, it may be necessary for some set-up code and/or syntactic glue.

In the program shown above, there are two pieces of syntactic glue.

The first part, public class HelloWorld, and the accompanying matched pair of curly braces, declare a Class construct. At this point, we could try and explain what a class is, but for someone who is genuinely new to programming, the explanation would probably be more of a distraction than a help. For now, we will settle for a simple universal truth – all Java code must be contained inside a Class construct.

The second part, public static void main(String[] args) and the accompanying matched pair of curly braces declare a Methodconstruct. In particular, they declare a special type of method that Java can use as the entry point for a program. A method is a somewhat simpler construct than a class, but for now we will just describe it as a group of runnable code. A main method is required for each and every Java program. (Methods are also known as ‘functions’ in some other programming languages such as C++.)

Java Virtual Machine (JVM)
This is generally referred as JVM. Before, we discuss about JVM lets see the phases of program execution. Phases are as follows: we write the program, then we compile the program and at last we run the program.
1) Writing of the program is of course done by java programmer like you and me.
2) Compilation of program is done by javac compiler, javac is the primary java compiler included in java development kit (JDK). It takes java program as input and generates java bytecode as output.
3) In third phase, JVM executes the bytecode generated by compiler. This is called program run phase.

Main Features of JAVA

Java is a platform independent language

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.

Java is an Object Oriented language

Object oriented programming is a way of organizing programs as collection of objects, each of which represents an instance of a class.

4 main concepts of Object Oriented programming are:

  1. Abstraction
  2. Encapsulation
  3. Inheritance
  4. Polymorphism

Simple

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 Language

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.

Secure

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.

Java is distributed

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.

Multithreading

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.

Portable

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.

 

 

Leave a Reply