27-08-2014, 12:48 PM
Java is a programming language created by James Gosling from Sun Microsystems (Sun) in 1991. The first publicly available version of Java (Java 1.0) was released in 1995.Sun Microsystems was acquired by the Oracle Corporation in 2010. Oracle has now the steermanship for Java.Over time new enhanced versions of Java have been released. The current version of Java is Java 1.7 which is also known as Java 7. From the Java programming language the Java platform evolved. The Java platform allows software developers to write program code in other languages than the Java programming language which still runs on the Java virtual machine. The Java platform is usually associated with the Java virtual machine and the Java core libraries. Java is an object-oriented programming language with a built-in application programming interface (API) that can handle graphics and user interfaces and that can be used to create applications or applets. Because of its rich set of API.s, similar to Macintosh and Windows, and its platform independence, Java can also be thought of as a platform in itself. Java a
Java is an object-oriented programming language with a built-in application programming interface (API) that can handle graphics and user interfaces and that can be used to create applications or applets. Because of its rich set of API.s, similar to Macintosh and Windows, and its platform independence, Java can also be thought of as a platform in itself. Java also has standard libraries for doing mathematics.
Much of the syntax of Java is the same as C and C++. One major difference is that Java does not have pointers. However, the biggest difference is that you must write object oriented code in Java. Procedural pieces of code can only be embedded in objects. In the following we assume that the reader has some familiarity with a programming language. In particular, some familiarity with the syntax of C/C++ is useful.
In Java we distinguish between applications, which are programs that perform the same functions as those written in other programming languages, and applets, which are programs that can be embedded in a Web page and accessed over the Internet. Our initial focus will be on writing applications. When a program is compiled, a byte code is produced that can be read and executed by any platform that can run Java.
History
Java is a programming language created by James Gosling from Sun Microsystems (Sun) in 1991. The first publicly available version of Java (Java 1.0) was released in 1995. Sun Microsystems was acquired by the Oracle Corporation in 2010. Oracle has now the steermanship for Java.Over time new enhanced versions of Java have been released. The current version of Java is Java 1.7 which is also known asJava 7.From the Java programming language theJava platformevolved. The Java platform allows software developers to write program code in other languages than the Java programming language which still runs on the Java virtual machine. TheJava platformis usually associated with theJava virtual machineand theJava core libraries.
Java and Open Source
In 2006 Sun started to make Java available under the GNU General Public License (GPL). Oracle continues this project calledOpen JDK.
Java Virtual machine
The Java virtual machine (JVM) is a software implementation of a computer that executes programs like a real machine.The Java virtual machine is written specifically for a specific operating system, e.g., for Linux a special implementation is required as well as for Windows.
FIGURE 1.1.1- Java Virtual Machine
Java programs are compiled by the Java compiler intobytecode. The Java virtual machine interprets thisbytecodeand executes the Java program.
Java Runtime Environment vs. Java Development Kit
A Java distribution typically comes in two flavors, theJava Runtime Environment(JRE) and theJava Development Kit(JDK).
The Java runtime environment (JRE) consists of the JVM and the Java class libraries. Those contain the necessary functionality to start Java programs.
The JDK additionally contains the development tools necessary to create Java programs. The JDK therefore consists of a Java compiler, the Java virtual machine and the Java class libraries.
FEATURES OF JAVA
JAVA is related to C++, which is direct descendent of C. Much of character of JAVA is inherited from these two languages. This language was initially called “Oak” but was renamed as JAVA. The trouble with C and C++ is that they are designed to be compiled for a specific target. Although it is possible to compile a C++ program for just about any type of CPU, to do so requires a full C++ compiler for that CPU. The problem is that compilers are expensive and time consuming to create. The solution of this problem led to the creation of java. Some important features of JAVA:
1) SIMPLE:JAVA is SIMPLE because in it we don.t use pointers as in C++ and it was designed to be easy professional programmer to learn and use effectively. If one already understands the basic concepts of object oriented programming learning Java will be even easier.
2) OBJECT-ORIENTED: JAVA is pure OBJECT-ORIENTED because in the JAVA main within the class. Object Oriented Programming is a way to software that is reusable, extensible and maintainable.
3) PLATFORM INDEPENDENT:JAVA is platform independent. For e.g. C++ programs are designed for specific target. For that we require C++ compiler which are expensive and time consuming to create. But in JAVA programs will also run on another PC because every operating system has Java Virtual Machine.
4) MULTITHREDED: A single-threaded application has one thread of execution running at all times, all such programmers can do only one task at a time. If a single threaded program need to perform a task that will take several minutes. But JAVA supports multithreaded programming which allows you to write programs that do many things simultaneously. Java synchronized keyword can be used to prevent two threads from entering the same critical block of code at the same time.
5) SECURITY:When you use a JAVA compatible Web-browser you can safely download Java applets without fear of viral infection by confining a Java program to the JAVA execution environment and not allowing it to access other parts of the computer.
6) ROBUSTNESS:The ability to create robust programs was given a priority in the design of JAVA .Java is strictly typed language, it checks your code at compile time. It checks code at run time. To better understand how Java is robust, consider two of the reasons for program failure, memory management mistakes and mishandled exception conditions. Memory management can be difficult tedious task in traditional programming environments. For example in C/C++ the programmer must manually allocate and free dynamic memory. This sometimes lead to problems because programmer will either forgot to free memory that has been previously allocated or worse try to free some memory that another part of their code is still using. Java virtually eliminates these problems by managing memory allocation and de-allocation .Exceptional conditions in traditional environments often arises in a situation such as division by zero or “file not found” and they must be managed with clumsy and hard-to-hard construct. Java helps in this area by providing object oriented exception handling. In well written Java programs, all run time errors can be managed by your program.
7) DISTRIBUTED:Java is designed for the distributed environment of the Internet because it handles TCP/IP protocols.
8) DYNAMIC:In the windows operating systems, parts of programs can be placed into Dynamic link libraries so that they can be shared and loaded dynamically i.e. when the program is running. The operating system does the final stage of linking at execution time. Using shared DLL (Dynamic Link Library) saves memory and improves the modality of the software. Java takes Dynamic Libraries a step further. The VM class loaded fetches class files from the network as well from the disk, providing location transparency making java applications distributed as well dynamic.
Java Script:
JavaScript is a compact, object-oriented scripting language. It can provide interactive web pages, validate from data, and make your web pages clearer. JavaScript is most well known for its use in Websites. It was originally developed by Brendan Eich of Netscape Communication. It adds functions to HTML pages, which are otherwise static. JavaScript is easier than Java, but not as powerful and deals mainly with elements on the Web page. On the client, JavaScript is maintained as source code embedded into an HTML page. On the server, it is compiled into byte code, similar to java programs.
Features of Java Script:
• JavaScript was designed to add interactivity to HTML pages.
• A JavaScript is an interpreted language.
• JavaScript is usually embedded directly in HTML pages.
• JavaScript is supported by all major browsers, like Netscape and Internet Explorer