Java Introduction

Java Introduction

Java Introduction

What is Java?

Java is a computer programming language. It enables programmers to write computer instructions using English based commands, instead of having to write in numeric codes. It’s known as a “high-level” language because it can be read and written easily by humans. Like English, Java has a set of rules that determine how the instructions are written. These rules are known as its “syntax”. Once a program has been written, the high-level instructions are translated into numeric codes that computers can understand and execute.
There are lots of applications and websites that won’t work unless you have Java installed, and more are created every day. Java is fast, secure, and reliable. From laptops to data enters, game consoles to scientific supercomputers, cell phones to the Internet, Java is everywhere.

Types of Java Applications:

Java can be used to develop different types of applications:

• Standalone Applications

• Applets

• Web Applications

• Distributed Applications

Standalone Applications: A standalone application is a program that runs on your computer. It is more or less like a C or C++ program.

Applets: An applet is an application designed to travel over the Internet and to be executed on the client machine by a Java-Compatible web browser like Internet Explorer or Netscape. Applets are also Java programs but they reside on the servers. An applet cannot be executed like standalone application. Applet can be executed only by embedding it into an HTML page like an image or sound file. To run an applet you need to access an HTML page which has applet embedded into it. When the web browser downloads such an HTML page, it subsequently loads the executable file, which contains Applet and then executes it on the local machine.

Web Applications: Web applications run on the Web Server. Web applications are accessed through web clients i.e. web browsers like Internet Explorer or Netscape. Whenever you access some web site by specifying the URL (Universal Resource Locator), you are accessing some web application. The main components of a web application written in Java are,

• Java Servlets

• Java Server Pages (JSP), and

Java Servlets are also Java programs, which run on the Server and then send the result/response to the client. JSP pages can be thought of as a combination of HTML and Java Code. The Web Server converts JSP pages into Java Servlets before execution.

You access the web application by specifying the URL. If the URL corresponds to an HTML page the web server simply returns the HTML page to the client, which then displays it. If the URL corresponds to the Servlet or JSP then it is executed on the Server and the result/response is returned to the client, which is then displayed by the client.
Distributed Applications: Java application can be divided into a number of modules/components (Java programs), which can run on different machines. The Java programs/applications running on different machines can communicate with each other. To be more precise the Java Objects on one machine can invoke methods on the Java Objects running on another machine. Thus Java has the support for the distributed processing in the language itself.

History of Java:

Java is a programming language developed by Sun Microsystems and published in 1995. Java programming language was originally born out of The Green Project. The project was initiated by Patrick Naughton, Mike Sheridan, James Gosling and Bill Boy along with nine other programmers from Sun Microsystems. To run the project Sun plans to make an operating system built with C + + language. However, James Gosling are not satisfied with the programming language C + + and finally he decided to create its own programming language called Oak. The name was taken from a tree visible from the window of his office. Oak is based on C + + language syntax. But Oak simpler than C + +, more stable and better support network-programming. Moreover Oak made pure object-oriented. Oak language created as a language that is not tied to one platform (cross-platform or multi-platform). At that time the Internet started a new history of the WWW (World Wide Web).
The first GUI browser was Mosaic. Sun saw another gap in the Web world. Sun Oak felt that multi-language platform and is intended for interactive and distributed programming is suitable for the Web. They made the Mosaic as the initial basis for making the first Java browser, later named the Web Runner. In 1995, the name Oak was replaced with the name Java because there is already patented software name. Java name taken from the ground coffee directly pure joy James Gosling. In 1995, java and then became the standard language in the Internet world.

There are many java versions that has been released, they are

• JDK Alpha and Beta (1995)

• JDK 1.0 (23rd Jan, 1996)

• JDK 1.1 (19th Feb, 1997)

• J2SE 1.2 (8th Dec, 1998)

• J2SE 1.3 (8th May, 2000)

• J2SE 1.4 (6th Feb, 2002)

• J2SE 5.0 (30th Sep, 2004)

• Java SE 6 (11th Dec, 2006)

• Java SE 7 (28th July, 2011)

Features of Java:

1) Simple and Powerful: If the user already understands the basic concepts of object-oriented programming, learning Java with be much easier, Because Java inherits the C/C++ syntax and many of the object-oriented features of we can say that Java was designed to be easy to learn and use.
Java provides a small number of clear ways to achieve a given task. Unlike other programming systems that they provide dozens of complicated ways to perform a simple task.

2) Secure: Using Java Compatible Browser, anyone can safely download Java applets without the fear of viral infection or malicious intent because of its key design principle. So anyone can download applets with confidence that no harm will be done and no security will be violated.
Java achieves this protection by confining a Java program to the Java execution environment and by making it inaccessible to other parts of the computer.

3) Portable: Many types of computers and operating systems are in use throughout the world—and many are connected to the Internet. Java makes it possible to have the assurance that any result on one computer with Java can be replicated on another. So the code is run in the different platform has a same result.

4) Object-oriented: Java support the all the features of object oriented programming language such as Abstraction, Encapsulation, Inheritance, Polymorphism and Dynamic binding etc….
So with the help of these features user can reduce the complexity of the program develops in JAVA. Java gave a clean, usable, realistic approach to objects so we can say that the object model in Java is simple and easy to extend.

5) Robust: Most programs in use today fail for one of the two reasons:

(i) Memory management mistakes:
For example, in C/C++, the programmer must manually allocate and free all dynamic memory. This sometimes leads to problems, because programmers will either forget to free memory that has been previously allocated or, sometimes try to free some memory that another part of their code is still using. Java virtually eliminates these problems by managing memory allocation (with the help of new operator) and deallocation. (Deallocation is completely automatic, because Java provides garbage collection for unused objects.)

(ii) Mishandled exceptional conditions:
With the help of Exception Handling (try……….catch block), the programmer can easily handle an error or exception so user can prevent the program by automatically stop the execution when an exception found.
Thus, the ability to create robust programs was given a high priority in the design of Java.

6) Multithreaded: Java supports programming, which allows the user to write programs that perform many functions simultaneously.
The two or more part of the program can run concurrently then each part of such a program is called a Thread and this type of programming is called multithreaded programming. Each thread defines a separate path of execution. Thus, multithreading is a specialized form of multitasking.

7) Architecture-neutral: The Java designers worked hard in achieving their goal “write once; run anywhere, anytime, forever” and as a result the Java Virtual Machine was developed. Java is Architecture-neutral it generates byte code that resembles machine code, and are not specific to any processor.

8) Interpreted and High performance: The source code is first compile and generates the code into an intermediate representation called Java byte code which is a highly optimized set of instruction code.
This code can be interpreted on any system that has a Java Virtual Machine and generates the machine code. Java byte code was carefully designed by using a just-in-time compiler so that it can be easily translated into native machine code for very high performance.
Most of the earlier cross-platform solutions are run at the expense of performance.

9) Distributed: Java allows the object can access the information across the network with the help of RMI (Remote Method Invocation) means this allowed objects on two different computers to execute procedures remotely. So this feature supports the client/server programming.

10) Dynamic: Java programs carry with them substantial amounts of run-time type information that is used to verify and resolve accesses to objects at run time. This makes it possible to dynamically link code in a safe and perfect manner.

Java Environment:

JRE Stands for “Java Runtime Environment” and may also be written “Java RTE.” Java is a programming language, similar to C. However, since it is a newer language, it is not natively supported by all operating systems. Therefore, a Java Runtime Environment may need to be installed on your computer for Java applets and Java applications to run.
The JRE, or Java RTE, is developed by Sun Microsystems (the creator of Java) and includes the Java Virtual Machine (JVM), code libraries, and components, which are necessary to run programs written in Java. The JRE is available for multiple computer platforms, including Mac, Windows, and UNIX.
If the JRE is not installed on a computer, Java programs may not be recognized by the operating system and will not run. The JRE software provides a runtime environment in which Java programs can be executed, just like software programs that have been fully compiled for the computer’s processor. JRE software is available as both a standalone environment and a Web browser plug-in, which allows Java applets to be run within a Web browser.

Follow me on social media: