We are creating the world's most trusted encyclopedia and knowledge base.
Once you join us and log in, you'll be able to edit this page instantly!

Java programming language

From Citizendium, the Citizens' Compendium

Jump to: navigation, search
Image:Statusbar2.png
Main Article
Talk
Related Articles  [?]
Bibliography  [?]
External Links  [?]
 
This is a draft article, under development. These unapproved articles are subject to a disclaimer.

Java is an object-oriented computer programming language now managed as open source software[1]. The Java source code compiler is part of the Java platform (a bundle of interdependent programs) originally specified and implemented by a team led by James Gosling (colloquially known as the "Father of Java")[2][3] while he worked at Sun in the early 1990's. Use of the Java programming language spread rapidly across the computer industry, and since 2003, Java has been the recommended teaching language for U. S. high schools for students planning to take the High School Advanced Placement exam[4] in Computer Science. See the Java release history.

Contents

Operating system independence

Java programs are able to run on many different types of operating systems without being compiled again. This is possible because an execution engine, also known as a virtual machine or runtime environment, has been implemented for most operating systems. The Java runtime environment makes all computers look alike so that Java programs can run identically on all of them. The direct result of having a virtual machine is that Java source code compiles initially down to an intermediate language, called Java bytecode. Java programs (.jar files) are binary files containing bytecode, and at runtime, the Java virtual machine (runtime environment) loads the bytecode and monitors its execution so that the program's behavior is identical regardless of which operation system is being used. For more about how this is accomplished, see the Java platform.

The Java programming language has access to extensive libraries containing reusable code. As well, there are numerous ways for Java applications to be deployed, including being embedded in a web page as an applet, on a desktop machine for a single user, on a web server as a servlet (returning "dynamic" information to web browsers), or on a web server as a web service endpoint (procedure callable across a network from any kind of platform).

In practice, certain kinds of Java programs require programmer effort to guarantee good cross-operating-system behavior. For example, graphical user interfaces on different operating systems tend to use different menu shortcuts, and text files on different systems have different line endings. So it is sometimes necessary for the programmer to write Java code which says "if I'm on this system, do this, but if I'm on that system, do something else." However, with appropriate care and testing, Java programs can be made to behave "perfectly" on all the major operating systems without being recompiled.

Classes and objects

The Java programming language is fully object-oriented, which means code is always bundled into one or more classes. A class may contain methods--the operations of the class (like functions or procedures in older languages). A class may also contain data--the fields of the class (like variables in older programming languages). The class is a recipe, written by a programmer, which tells the virtual machine how to create an object at runtime. Classes, and objects created using them, have been compared to structs in C or C++, but classes and objects (unlike structs) can be extended and modified without recompilation.

A Java program consists of cooperating objects of different types. Some of the classes (types) are made from classes coded by the application programmer. Some types are pre-compiled, from the standard Java libraries (written by Sun programmers); other types may be libraries that the programmer has modified (extended).

Strong typing

Prior to Java, C++ was the dominant programming language in the computer industry. Compared with C++, Java code is typically more robust because the Java platform prevents direct pointer manipulation and performs strong type checking at both compile- and run-time. These safety features in Java make it less likely that one ill-behaving program will harm other users or programs on a shared computer. These restrictions also limit the power of the Java programmer somewhat. Java is considered a "higher-level" language than C or C++.

The Java Class Libraries

Also called the Base Class Library, these libraries ("packages") are available to every program written in Java, regardless of operating system. They consist of ~2500 or more reusable classes.

References

  1. Open-Source Java Project Overview. Retrieved on 2007-04-08.
  2. The Java Language Specification. Retrieved on 2007-10-06.
  3. FATHER OF JAVA, JAMES GOSLING, CELEBRATES "INNOVATION EVERYWHERE" WITH JAVA TECHNOLOGY. Retrieved on 2007-10-06.
  4. "Subjects" High School Advanced Placement. The College Board (2007). Retrieved on 2007-05-17.
Views
Personal tools