Aug 05 2008

java history chapter3

Published by mac0002 at 3:08 pm under technology

JavaServer Page

Main article: JavaServer Pages

JavaServer Pages (JSPs) are server-side Java EE components that generate responses, typically HTML pages, to HTTP requests from clients. JSPs embed Java code in an HTML page by using the special delimiters <% and %>. A JSP is compiled to a Java servlet, a Java application in its own right, the first time it is accessed. After that, the generated servlet creates the response.

[edit] Swing application

Main article: Swing (Java)

Swing is a graphical user interface library for the Java SE platform. This example Swing application creates a single window with “Hello, world!” inside:

// Hello.java (Java SE 5) import java.awt.BorderLayout; import javax.swing.*;   public class Hello extends JFrame {     public Hello() {         super("hello");         setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);         setLayout(new BorderLayout());         add(new JLabel("Hello, world!"));         pack();     }       public static void main(String[] args) {         new Hello().setVisible(true);     } }

The first import statement directs the Java compiler to include the BorderLayout class from the java.awt package in the compilation; the second import includes all of the public classes and interfaces from the javax.swing package.

The Hello class extends the JFrame class; the JFrame class implements a window with a title bar and a close control.

The Hello() constructor initializes the frame by first calling the superclass constructor, passing the parameter “hello”, which is used as the window’s title. It then calls the setDefaultCloseOperation(int) method inherited from JFrame to set the default operation when the close control on the title bar is selected to WindowConstants.EXIT_ON_CLOSE — this causes the JFrame to be disposed of when the frame is closed (as opposed to merely hidden), which allows the JVM to exit and the program to terminate. Next, the layout of the frame is set to a BorderLayout; this tells Swing how to arrange the components that will be added to the frame. A JLabel is created for the string “Hello, world!” and the add(Component) method inherited from the Container superclass is called to add the label to the frame. The pack() method inherited from the Window superclass is called to size the window and lay out its contents, in the manner indicated by the BorderLayout.

The main() method is called by the JVM when the program starts. It instantiates a new Hello frame and causes it to be displayed by calling the setVisible(boolean) method inherited from the Component superclass with the boolean parameter true. Note that once the frame is displayed, exiting the main method does not cause the program to terminate because the AWT event dispatching thread remains active until all of the Swing top-level windows have been disposed.

[edit] Generics

See also: Generics in Java

[edit] Criticism

It has been suggested that some of the information in this article’s Criticism or Controversy section(s) be merged into other sections to achieve a more neutral presentation. (Discuss)

Main article: Criticism of Java

Java’s performance has improved substantially since the early versions, and performance of JIT compilers relative to native compilers has in some tests been shown to be quite similar.[18][19][20] The performance of the compilers does not necessarily indicate the performance of the compiled code; only careful testing can reveal the true performance issues in any system.

The default look and feel of GUI applications written in Java using the Swing toolkit is very different from native applications. It is possible to specify a different look and feel through the pluggable look and feel system of Swing. Clones of Windows, GTK and Motif are supplied by Sun. Apple also provides an Aqua look and feel for Mac OS X. Though prior implementations of these looks and feels have been considered lacking,[citation needed] Swing in Java SE 6 addresses this problem by using more native widget drawing routines of the underlying platforms. Alternatively, third party toolkits such as wx4j, Qt Jambi or SWT may be used for increased integration with the native windowing system.

As in C++ and some other object-oriented languages, variables of Java’s primitive types were not originally objects. Values of primitive types are either stored directly in fields (for objects) or on the stack (for methods) rather than on the heap, as is the common case for objects (but see Escape analysis). This was a conscious decision by Java’s designers for performance reasons. Because of this, Java was not considered to be a pure object-oriented programming language. However, as of Java 5.0, autoboxing enables programmers to write as if primitive types are their wrapper classes, with their object-oriented counterparts representing classes of their own, and freely interchange between them for improved flexibility.

Java suppresses several features (such as operator overloading and multiple inheritance) for classes in order to simplify the language, to “save the programmers from themselves”, and to prevent possible errors and anti-pattern design. This has been a source of criticism,[citation needed] relating to a lack of low-level features, but some of these limitations may be worked around. Java interfaces have always had multiple inheritance.

[edit] Target

Main article: Java Runtime Environment

The Java Runtime Environment, or JRE, is the software required to run any application deployed on the Java Platform. End-users commonly use a JRE in software packages and Web browser plugins. Sun also distributes a superset of the JRE called the Java 2 SDK (more commonly known as the JDK), which includes development tools such as the Java compiler, Javadoc, Jar and debugger.

One of the unique advantages of the concept of a runtime engine is that errors (exceptions) should not ‘crash’ the system. Moreover, in runtime engine environments such as Java there exist tools that attach to the runtime engine and every time that an exception of interest occurs they record debugging information that existed in memory at the time the exception was thrown (stack and heap values). These Automated Exception Handling tools provide ‘root-cause’ information for exceptions in Java programs that run in production, testing or development environments.

[edit] Class libraries

[edit] APIs

See also: Free Java implementations#Class library

Sun has defined three platforms targeting different application environments and segmented many of its APIs so that they belong to one of the platforms. The platforms are:

The classes in the Java APIs are organized into separate groups called packages. Each package contains a set of related interfaces, classes and exceptions. Refer to the separate platforms for a description of the packages available.

The set of APIs is controlled by Sun Microsystems in cooperation with others through the Java Community Process program. Companies or individuals participating in this process can influence the design and development of the APIs. This process has been a subject of controversy.

[edit] See also

[edit] Notes

  1. ^The Java Language Environment” (May 1996).
  2. ^The Java Language Specification, 2nd Edition“.
  3. ^ Java 5.0 added several new language features (the enhanced for loop, autoboxing, varargs and annotations), after they were introduced in the similar (and competing) C# language. [1][2]
  4. ^ Jon Byous, Java technology: The early years. Sun Developer Network, no date [ca. 1998]. Retrieved April 22, 2005.
  5. ^ http://blogs.sun.com/jonathan/entry/better_is_always_different.
  6. ^ Heinz Kabutz, Once Upon an Oak. Artima, Retrieved April 29, 2007.
  7. ^ Java Study Group
  8. ^ Why Java Was - Not - Standardized Twice
  9. ^ What is ECMA–and why Microsoft cares
  10. ^ Java Community Process website
  11. ^ open.itworld.com - JAVAONE: Sun - The bulk of Java is open sourced
  12. ^ 1.2 Design Goals of the JavaTM Programming Language
  13. ^ Java SE - Licensees
  14. ^ James Niccolai (January 23, 2001). “Sun, Microsoft settle Java lawsuit“, JavaWorld, IDG. Retrieved on 2008-07-09
  15. ^ Stroustrup: C++ Style and Technique FAQ
  16. ^ Using the applet Tag (The Java Tutorials > Deployment > Applets)
  17. ^ Deploying Applets in a Mixed-Browser Environment (The Java Tutorials > Deployment > Applets)
  18. ^ Performance of Java versus C++, J.P.Lewis and Ulrich Neumann, Computer Graphics and Immersive Technology Lab, University of Southern California
  19. ^ The Java is Faster than C++ and C++ Sucks Unbiased Benchmark
  20. ^ FreeTTS - A Performance Case Study, Willie Walker, Paul Lamere, Philip Kwok

[edit] References

[edit] External links

Wikibooks has a book on the topic of

Java Programming

At Wikiversity, you can learn about: java

[show]

v • d • e

Java

[show]

v • d • e

Sun Microsystems

[show]

v • d • e

Free and open source software

Free software
portal

Retrieved from “http://en.wikipedia.org/wiki/Java_%28programming_language%29

Categories: Cleanup from section | Java programming language | Java platform | Java specification requests | C programming language family | Sun Microsystems | Concurrent programming languages | Class-based programming languages | Object-oriented programming languages | JVM programming languages | JVM programming language

Hidden categories: Articles with too many examples | All articles with unsourced statements | Articles with unsourced statements since May 2008

Trackback URI | Comments RSS

Leave a Reply

*
To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-Spam Image