Citizendia

Java
ParadigmObject-oriented, structured, imperative
Appeared in1995
Designed bySun Microsystems
Latest releaseJava Standard Edition 6 (1. A programming paradigm is a fundamental style of Computer programming. Object-oriented programming (OOP is a Programming paradigm that uses " objects " and their interactions to design applications and computer programs Structured programming can be seen as a subset or subdiscipline of Procedural programming, one of the major Programming paradigms It is most famous for removing or In Computer science, imperative programming is a Programming paradigm that describes computation in terms of statements that change a program state Year 1995 ( MCMXCV) was a Common year starting on Sunday. Events of 1995 Sun Microsystems Inc ( is a multinational vendor of Computers computer components Computer software, and Information technology services A software release is the distribution whether public or private of an initial or new and upgraded version of a Computer software product 6. 0)
Turing-completeYes
Typing disciplineStatic, strong, safe, nominative
Major implementationsNumerous
Influenced byObjective-C, C++, Smalltalk, Eiffel[1], Ada 83, Mesa[2], C#[3]
InfluencedC#, D, J#, Ada 2005, ECMAScript, PHP, Scala
OSCross-platform
LicenseGNU General Public License / Java Community Process
Websitehttp://java.sun.com

Java is a programming language originally developed by Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. In computability theory, several closely-related terms are used to describe the "computational power" of a computational system (such as an Abstract machine or In Computer science, a type system defines how a Programming language classifies values and expressions into '''types''', how it can In Computer science, a type system defines how a Programming language classifies values and expressions into '''types''', how it can In Computer science nominative type system is a major class of Type system, in which type compatibility and equivalence is determined by explicit declarations and/or Implementation is the realization of an application or execution of a Plan, idea Model, Design, Specification, standard, Algorithm Objective-C is a reflective, object-oriented Programming language which adds Smalltalk -style messaging to C. C++ (" C Plus Plus " ˌsiːˌplʌsˈplʌs is a general-purpose Programming language. Smalltalk is an object-oriented, dynamically typed, reflective programming language. Eiffel is an ISO -standardized Object-oriented Programming language designed to enable programmers to efficiently develop extensible reusable reliable Ada is a structured, Statically typed, imperative, and object-oriented high-level computer Programming language Mesa is a programming language developed at Xerox PARC. The name Mesa was a pun referring to its design intent to be a "high-level" C# (pronounced C Sharp is a Multi-paradigm C# (pronounced C Sharp is a Multi-paradigm The D programming language, also known simply as D, is an object-oriented, imperative, multiparadigm System programming language Ada is a structured, Statically typed, imperative, and object-oriented high-level computer Programming language ECMAScript is a Scripting language, standardized by Ecma International in the ECMA-262 specification. PHP is a computer Scripting language. Originally designed for producing Dynamic web pages it has evolved to include a Command line interface capability Scala ( Scalable Language) is a multi-paradigm Programming language designed to integrate features of Object-oriented programming and An operating system (commonly abbreviated OS and O/S) is the software component of a Computer system that is responsible for the management and coordination In computing cross-platform (also known as multi-platform) is a term used to refer to Computer software or computing methods and concepts that are implemented A software license (or software licence in commonwealth usage is a Legal instrument governing the usage or redistribution of copyright protected software The Java Community Process or JCP, established in 1998, is a formalized process which allows interested parties to be involved in the definition of future versions A website (alternatively web site or Web site, a back-construction from the Proper noun World Wide Web) is a collection of Web pages A programming language is an Artificial language that can be used to write programs which control the behavior of a machine particularly a Computer. Sun Microsystems Inc ( is a multinational vendor of Computers computer components Computer software, and Information technology services Java refers to a number of Computer software products and specifications from Sun Microsystems that together provide a system for developing Application software The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities. In Computer science, the syntax of a Programming language is the set of rules that a sequence of characters in a Source code file must follow to be considered as a tags please moot on the talk page first! --> In Computing, C is a general-purpose cross-platform block structured C++ (" C Plus Plus " ˌsiːˌplʌsˈplʌs is a general-purpose Programming language. In Computing, object model has two related but distinct meanings The properties of objects in general in a specific computer Programming language Java applications are typically compiled to bytecode that can run on any Java virtual machine (JVM) regardless of computer architecture. A compiler is a Computer program (or set of programs that translates text written in a computer language (the source language) into another Bytecode is a term which has been used to denote various forms of Instruction sets designed for efficient execution by a software interpreter as well as being suitable A Java Virtual Machine ( JVM) is a set of computer software programs and data structures which use a Virtual machine In Computer engineering, computer architecture is the conceptual design and fundamental operational structure of a Computer system

The original and reference implementation Java compilers, virtual machines, and class libraries were developed by Sun from 1995. In Computing, a reference implementation (or less frequently sample implementation or model implementation) is a software example of a Specification A compiler is a Computer program (or set of programs that translates text written in a computer language (the source language) into another In Computer science, a library is a collection of Subroutines used to develop Software. As of May 2007, in compliance with the specifications of the Java Community Process, Sun made available most of their Java technologies as free software under the GNU General Public License. The Java Community Process or JCP, established in 1998, is a formalized process which allows interested parties to be involved in the definition of future versions Free software or software libre is Software that can be used studied and modified without restriction and which can be copied and redistributed in modified or unmodified Others have also developed alternative implementations of these Sun technologies, such as the GNU Compiler for Java and GNU Classpath. The GNU Compiler for Java ( GCJ or gcj) a free-software Compiler for the Java programming language, forms part of the GNU Compiler GNU Classpath is a project aiming to create a Free software implementation of the standard class library for the Java programming language.

Contents

History

Duke, the Java mascot
Duke, the Java mascot

The Java language was created by James Gosling in June 1991 for use in one of his many set-top box projects. Java refers to a number of Computer software products and specifications from Sun Microsystems that together provide a system for developing Application software The Java language has undergone several changes since JDK 10 as well as numerous additions of classes and packages to the standard library. James A Gosling OC, PhD (born May 19, 1955 near Calgary, Alberta, Canada) is a famous Software developer A set-top box (STB or set-top unit (STU is a device that connects to a Television and an external source of signal, turning the signal into [4] The language was initially called Oak, after an oak tree that stood outside Gosling's office—and also went by the name Green—and ended up later being renamed to Java, from a list of random words. The term oak can be used as part of the common name of any of about 400 species of Trees and Shrubs in the Genus Quercus (from Latin [5] Gosling's goals were to implement a virtual machine and a language that had a familiar C/C++ style of notation. In Computer science, a virtual machine (VM is a Software implementation of a machine (computer that executes programs like a real machine [6] The first public implementation was Java 1. 0 in 1995. It promised "Write Once, Run Anywhere" (WORA), providing no-cost runtimes on popular platforms. " Write once run anywhere " ( WORA) or sometimes Write once run everywhere (WORE is a slogan created by Sun Microsystems to illustrate the It was fairly secure and its security was configurable, allowing network and file access to be restricted. Major web browsers soon incorporated the ability to run secure Java applets within web pages. An applet is a software component that runs in the context of another program for example a Web browser. Java quickly became popular. With the advent of Java 2, new versions had multiple configurations built for different types of platforms. For example, J2EE was for enterprise applications and the greatly stripped down version J2ME was for mobile applications. Java Platform Enterprise Edition or Java EE is a widely used platform for server programming in the Java programming language In computing the Java Platform Micro Edition or Java ME (still commonly referred to by its previous name Java 2 Platform Micro Edition or J2ME) is a specification J2SE was the designation for the Standard Edition. Java Platform Standard Edition or Java SE is a widely used platform for Programming in the Java language In 2006, for marketing purposes, new J2 versions were renamed Java EE, Java ME, and Java SE, respectively.

In 1997, Sun Microsystems approached the ISO/IEC JTC1 standards body and later the Ecma International to formalize Java, but it soon withdrew from the process. Ecma International (Ecma is an international private (membership-based non-profit Standards organization for information and communication systems [7][8][9] Java remains a de facto standard that is controlled through the Java Community Process. The Java Community Process or JCP, established in 1998, is a formalized process which allows interested parties to be involved in the definition of future versions [10] At one time, Sun made most of its Java implementations available without charge although they were proprietary software. Proprietary software is Computer software on which the producer has set restrictions on use private modification copying, or republishing. Sun's revenue from Java was generated by the selling of licenses for specialized products such as the Java Enterprise System. Sun distinguishes between its Software Development Kit (SDK) and Runtime Environment (JRE) that is a subset of the SDK, the primary distinction being that in the JRE, the compiler, utility programs, and many necessary header files are not present. A software development kit ( SDK or " devkit " is typically a set of development tools that allows a Software engineer to create applications HotSpot is the primary Java Virtual Machine for desktops and servers produced by Sun Microsystems.

On 13 November 2006, Sun released much of Java as free software under the terms of the GNU General Public License (GPL). Events 1002 - English king Ethelred orders the killing of all Danes in England, known today as the St Year 2006 ( MMVI) was a Common year starting on Sunday of the Gregorian calendar. Free software or software libre is Software that can be used studied and modified without restriction and which can be copied and redistributed in modified or unmodified On 8 May 2007 Sun finished the process, making all of Java's core code open source, aside from a small portion of code to which Sun did not hold the copyright. Events 589 - Reccared summons the Third Council of Toledo 1450 - Jack Cade's Rebellion: Kentishmen Year 2007 ( MMVII) was a Common year starting on Monday of the Gregorian calendar in the 21st century. Open source is a development methodology which offers practical accessibility to a product's source (goods and knowledge [11]

Philosophy

Primary goals

There were five primary goals in the creation of the Java language:[12]

  1. It should use the object-oriented programming methodology. Object-oriented programming (OOP is a Programming paradigm that uses " objects " and their interactions to design applications and computer programs
  2. It should allow the same program to be executed on multiple operating systems. Execution in computer and Software engineering is the process by which a Computer or Virtual computer carries out the instructions An operating system (commonly abbreviated OS and O/S) is the software component of a Computer system that is responsible for the management and coordination
  3. It should contain built-in support for using computer networks. A computer network is a group of interconnected Computers. Networks may be classified according to a wide variety of characteristics
  4. It should be designed to execute code from remote sources securely. Remote procedure call ( RPC) is an Inter-process communication technology that allows a Computer program to cause a Subroutine or procedure to
  5. It should be easy to use by selecting what were considered the good parts of other object-oriented languages.

Platform independence

Main article: Java Platform

One characteristic, platform independence, means that programs written in the Java language must run similarly on any supported hardware/operating-system platform. Java refers to a number of Computer software products and specifications from Sun Microsystems that together provide a system for developing Application software In computing cross-platform (also known as multi-platform) is a term used to refer to Computer software or computing methods and concepts that are implemented Computer programs (also software programs, or just programs) are instructions for a Computer. One should be able to write a program once, compile it once, and run it anywhere.

This is achieved by most Java compilers by compiling the Java language code halfway (to Java bytecode) – simplified machine instructions specific to the Java platform. A compiler is a Computer program (or set of programs that translates text written in a computer language (the source language) into another Java bytecode is the form of instructions that the Java virtual machine executes The code is then run on a virtual machine (VM), a program written in native code on the host hardware that interprets and executes generic Java bytecode. In Computer science, a virtual machine (VM is a Software implementation of a machine (computer that executes programs like a real machine In Computer science, an interpreter normally means a Computer program that executes, i (In some JVM versions, bytecode can also be compiled to native code, either before or during program execution, resulting in faster execution. ) Further, standardized libraries are provided to allow access to features of the host machines (such as graphics, threading and networking) in unified ways. A thread in Computer science is short for a thread of execution. A computer network is a group of interconnected Computers. Networks may be classified according to a wide variety of characteristics Note that, although there is an explicit compiling stage, at some point, the Java bytecode is interpreted or converted to native machine code by the JIT compiler. Machine code or machine language is a system of instructions and data executed directly by a Computer 's Central processing unit. In Computing, just-in-time compilation ( JIT) also known as dynamic translation, is a technique for improving the runtime performance of a Computer

The first implementations of the language used an interpreted virtual machine to achieve portability. See also Software portability In Computer science, porting is the process of adapting software so that an executable program can be created These implementations produced programs that ran slower than programs compiled to native executables, for instance written in C or C++, so the language suffered a reputation for poor performance. More recent JVM implementations produce programs that run significantly faster than before, using multiple techniques.

One technique, known as just-in-time compilation (JIT), translates the Java bytecode into native code at the time that the program is run, which results in a program that executes faster than interpreted code but also incurs compilation overhead during execution. More sophisticated VMs use dynamic recompilation, in which the VM can analyze the behavior of the running program and selectively recompile and optimize critical parts of the program. In Computer science, dynamic recompilation (sometimes abbreviated to dynarec or the Pseudo-acronym DRC) is a feature of some Emulators Dynamic recompilation can achieve optimizations superior to static compilation because the dynamic compiler can base optimizations on knowledge about the runtime environment and the set of loaded classes, and can identify the hot spots (parts of the program, often inner loops, that take up the most execution time). JIT compilation and dynamic recompilation allow Java programs to take advantage of the speed of native code without losing portability.

Another technique, commonly known as static compilation, is to compile directly into native code like a more traditional compiler. Static Java compilers, such as GCJ, translate the Java language code to native object code, removing the intermediate bytecode stage. The GNU Compiler for Java ( GCJ or gcj) a free-software Compiler for the Java programming language, forms part of the GNU Compiler In Computer science, object code, or an object file, is the representation of code that a Compiler or Assembler generates by processing This achieves good performance compared to interpretation, but at the expense of portability; the output of these compilers can only be run on a single architecture. In Computer engineering, computer architecture is the conceptual design and fundamental operational structure of a Computer system Some see avoiding the VM in this manner as defeating the point of developing in Java; however it can be useful to provide both a generic bytecode version, as well as an optimised native code version of an application. Bytecode is a term which has been used to denote various forms of Instruction sets designed for efficient execution by a software interpreter as well as being suitable

Implementations

Sun Microsystems officially licenses the Java Standard Edition platform for Microsoft Windows, Linux, and Solaris. Microsoft Windows is a series of Software Operating systems and Graphical user interfaces produced by Microsoft. Linux (commonly pronounced ˈlɪnəks Solaris is a Unix -based Operating system introduced by Sun Microsystems in 1992 as the successor to SunOS. Through a network of third-party vendors and licensees[13], alternative Java environments are available for these and other platforms. To qualify as a certified Java licensee, an implementation on any particular platform must pass a rigorous suite of validation and compatibility tests. This method enables a guaranteed level of compliance and platform through a trusted set of commercial and non-commercial partners.

Sun's trademark license for usage of the Java brand insists that all implementations be "compatible". This resulted in a legal dispute with Microsoft after Sun claimed that the Microsoft implementation did not support the RMI and JNI interfaces and had added platform-specific features of their own. Microsoft Corporation is an American multinational Computer technology Corporation, which rose to dominate the Home computer The Java Remote Method Invocation API, or Java RMI, is a Java application programming interface for performing the object equivalent of Remote procedure The Java Native Interface ( JNI) is a programming framework that allows Java code running in the Java virtual machine (JVM to call and be called Sun sued and won both damages in 1997 (some $20 million) and a court order enforcing the terms of the license from Sun. As a result, Microsoft no longer ships Java with Windows, and in recent versions of Windows, Internet Explorer cannot support Java applets without a third-party plugin. Microsoft Windows is a series of Software Operating systems and Graphical user interfaces produced by Microsoft. Windows Internet Explorer (formerly Microsoft Internet Explorer abbreviated MSIE) commonly abbreviated to IE, is a series of graphical However, Sun and others have made available Java run-time systems at no cost for those and other versions of Windows.

Platform-independent Java is essential to the Java Enterprise Edition strategy, and an even more rigorous validation is required to certify an implementation. Java Platform Enterprise Edition or Java EE is a widely used platform for server programming in the Java programming language This environment enables portable server-side applications, such as Web services, servlets, and Enterprise JavaBeans, as well as with Embedded systems based on OSGi, using Embedded Java environments. A Web service (also Web Service) is defined by the W3C as "a software system designed to support interoperable machine-to-machine interaction The Java Servlet API allows a Software developer to add dynamic content to a Web server using the Java platform. Enterprise JavaBeans&trade ( EJB) is a managed server-side component architecture for modular construction of enterprise applications An embedded system is a special-purpose Computer system designed to perform one or a few dedicated functions often with Real-time computing constraints The OSGi Alliance (formerly known as the Open Services Gateway initiative now an obsolete name is an open Standards organization founded in March 1999 In discussions of J2ME Java specifications such as the CDC / CLDC device capability sets and the MIDP profile definition attention needs to be given to Through the new GlassFish project, Sun is working to create a fully functional, unified open-source implementation of the Java EE technologies. GlassFish is an open source Application server project led by Sun Microsystems for the Java Enterprise Edition (Java EE platform Open source is a development methodology which offers practical accessibility to a product's source (goods and knowledge

Automatic memory management

See also: Garbage collection (computer science)

One of the ideas behind Java's automatic memory management model is that programmers be spared the burden of having to perform manual memory management. In Computer science, garbage collection ( GC) is a form of automatic Memory management. In some languages the programmer allocates memory for the creation of objects stored on the heap and the responsibility of later deallocating that memory also resides with the programmer. If the programmer forgets to deallocate memory or writes code that fails to do so, a memory leak occurs and the program can consume an arbitrarily large amount of memory. In Computer science, a memory leak is a particular type of unintentional memory consumption by a Computer program where the program fails to release memory Additionally, if the program attempts to deallocate the region of memory more than once, the result is undefined and the program may become unstable and may crash. Finally, in non garbage collected environments, there is a certain degree of overhead and complexity of user-code to track and finalize allocations. Often developers may box themselves into certain designs to provide reasonable assurances that memory leaks will not occur. [14]

In Java, this potential problem is avoided by automatic garbage collection. In Computer science, garbage collection ( GC) is a form of automatic Memory management. The programmer determines when objects are created, and the Java runtime is responsible for managing the object's lifecycle. In Computer science, the object lifetime (or life cycle) of an object in Object-oriented programming is the time between an object's creation The program or other objects can reference an object by holding a reference to it (which, from a low-level point of view, is its address on the heap). When no references to an object remain, the unreachable object is eligible for release by the Java garbage collector - it may be freed automatically by the garbage collector at any time. In Computer science, unreachable memory is a block of memory allocated dynamically where the program that allocated the memory no longer has Memory leaks may still occur if a programmer's code holds a reference to an object that is no longer needed—in other words, they can still occur but at higher conceptual levels.

The use of garbage collection in a language can also affect programming paradigms. If, for example, the developer assumes that the cost of memory allocation/recollection is low, they may choose to more freely construct objects instead of pre-initializing, holding and reusing them. With the small cost of potential performance penalties (inner-loop construction of large/complex objects), this facilitates thread-isolation (no need to synchronize as different threads work on different object instances) and data-hiding. The use of transient immutable value-objects minimizes side-effect programming.

Comparing Java and C++, it is possible in C++ to implement similar functionality (for example, a memory management model for specific classes can be designed in C++ to improve speed and lower memory fragmentation considerably), with the possible cost of adding comparable runtime overhead to that of Java's garbage collector, and of added development time and application complexity if one favors manual implementation over using an existing third-party library. C++ (" C Plus Plus " ˌsiːˌplʌsˈplʌs is a general-purpose Programming language. In Java, garbage collection is built-in and virtually invisible to the developer. That is, developers may have no notion of when garbage collection will take place as it may not necessarily correlate with any actions being explicitly performed by the code they write. Depending on intended application, this can be beneficial or disadvantageous: the programmer is freed from performing low-level tasks, but at the same time loses the option of writing lower level code. Additionally, the garbage collection capability demands some attention to tuning the JVM, as large heaps will cause apparently random stalls in performance.

Java does not support pointer arithmetic as is supported in, for example, C++. This is because the garbage collector may relocate referenced objects, invalidating such pointers. Another reason that Java forbids this is that type safety and security can no longer be guaranteed if arbitrary manipulation of pointers is allowed.

Syntax

Main article: Java syntax

The syntax of Java is largely derived from C++. The Syntax of the Java programming language is a set of rules that defines how a Java program is written and interpreted C++ (" C Plus Plus " ˌsiːˌplʌsˈplʌs is a general-purpose Programming language. Unlike C++, which combines the syntax for structured, generic, and object-oriented programming, Java was built exclusively as an object oriented language. As a result, almost everything is an object and all code is written inside a class. The exceptions are the intrinsic data types (ordinal and real numbers, boolean values, and characters), which are not classes for performance reasons.

Hello, world program

This is a minimal Hello world program in Java with syntax highlighting:

// Hello. A "Hello World" program is a Computer program that prints out "Hello world!" on a Display device. Syntax highlighting is a feature of some Text editors that displays text&mdashespecially Source code &mdashin different colors and fonts according to javapublic class Hello {    public static void main(String[] args) {        System. out. println("Hello, world!");    }}

To execute a Java program, the code is saved as a file named Hello. java. It must first be compiled into bytecode using a Java compiler, which produces a file named Hello. A Java compiler is a Compiler for the Java programming language. class. This class is then launched.

The above example merits a bit of explanation.

A more comprehensive example

// OddEven. javaimport javax. swing. JOptionPane; public class OddEven {    public static void main(String[] args) {        // This is the main method.  It gets called when this class is run through a Java interpreter.         OddEven number = new OddEven();        /* This line of code creates a new instance of this class called "number" and          * initializes it, and the next line of code calls the "showDialog()" method,          * which brings up a prompt to ask you for a number         */        number. showDialog();    }    private int input; // A whole number("int" means integer)        // "input" is the number that the user gives to the computer     public OddEven() {        /* This is the constructor method.  It gets called when an object of the OddEven type         * is created.          */    }     public void showDialog() {        try         /* This makes sure nothing goes wrong.  If something does,          * the interpreter skips to "catch" to see what it should do.          */        {                input = Integer. parseInt(JOptionPane. showInputDialog("Please Enter A Number"));                calculate();                /*                 * The code above brings up a JOptionPane, which is a dialog box                 * The String returned by the "showInputDialog()" method is converted into                 * an integer, making the program treat it as a number instead of a word.                  * After that, this method calls a second method, calculate() that will                 * display either "Even" or "Odd. "                 */        }        catch (NumberFormatException e)        /* This means that there was a problem with the format of the number          * (Like if someone were to type in 'Hello world' instead of a number).          */        {                System. err. println("ERROR: Invalid input.  Please type in a numerical value. ");        }    }     public void calculate() {        if (input % 2 == 0)                System. out. println("Even");        /* When this gets called, it sends a message to the interpreter.           * The interpreter usually shows it on the command prompt (For Windows users)          * or the terminal (For Linux users). (Assuming it's open)         */        else                System. out. println("Odd");    }}

Applet

Main article: Java applet

Java applets are programs that are embedded in other applications, typically in a Web page displayed in a Web browser. A Java applet is an Applet delivered in the form of Java bytecode. A web browser is a software application which enables a user to display and interact with text images videos music games and other information typically located on a

// Hello. javaimport java. applet. Applet;import java. awt. Graphics; public class Hello extends Applet {    public void paint(Graphics gc) {        gc. drawString("Hello, world!", 65, 95);    }    }

The import statements direct the Java compiler to include the java.applet.Applet and java.awt.Graphics classes in the compilation. A Java compiler is a Compiler for the Java programming language. The import statement allows these classes to be referenced in the source code using the simple class name (i. In Computer science, source code (commonly just source or code) is any sequence of statements or declarations written in some Human-readable e. Applet) instead of the fully qualified class name (i. e. java. applet. Applet).

The Hello class extends (subclasses) the Applet class; the Applet class provides the framework for the host application to display and control the lifecycle of the applet. In Object-oriented programming, a subclass is a class that inherits some properties from its superclass. In Computer science, the object lifetime (or life cycle) of an object in Object-oriented programming is the time between an object's creation The Applet class is an Abstract Windowing Toolkit (AWT) Component, which provides the applet with the capability to display a graphical user interface (GUI) and respond to user events. The Abstract Window Toolkit (AWT is Java 's original platform-independent windowing, Graphics and User-interface Widget toolkit. In Computer programming, event-driven programming or event-based programming is a Programming paradigm in which the flow of the program is determined

The Hello class overrides the paint(Graphics) method inherited from the Container superclass to provide the code to display the applet. Method overriding, in Object oriented programming, is a language feature that allows a subclass to provide a specific implementation of a method that is In Computer science, a superclass is a class from which other classes are derived The paint() method is passed a Graphics object that contains the graphic context used to display the applet. The paint() method calls the graphic context drawString(String, int, int) method to display the "Hello, world!" string at a pixel offset of (65, 95) from the upper-left corner in the applet's display. In Digital imaging, a pixel ( pict ure el ement is the smallest piece of information in an image

<!-- Hello. html --><html>  <head>    <title>Hello World Applet</title>  </head>  <body>    <applet code="Hello" width="200" height="200">    </applet>  </body></html>

An applet is placed in an HTML document using the <applet> HTML element. HTML, an initialism of HyperText Markup Language, is the predominant Markup language for Web pages It provides a means to describe the structure In Computing, an HTML element indicates structure in an HTML document and a way of hierarchically arranging content The applet tag has three attributes set: code="Hello" specifies the name of the Applet class and width="200" height="200" sets the pixel width and height of the applet. Applets may also be embedded in HTML using either the object or embed element[15], although support for these elements by Web browsers is inconsistent. [16] However, the applet tag is deprecated, so the object tag is preferred where supported.

The host application, typically a Web browser, instantiates the Hello applet and creates an AppletContext for the applet. Once the applet has initialized itself, it is added to the AWT display hierarchy. The paint method is called by the AWT event dispatching thread whenever the display needs the applet to draw itself. The event dispatching thread (EDT is a background thread used in Java to process events from the Abstract Windowing Toolkit (AWT Graphical user interface

Servlet

Main article: Java Servlet

Java Servlet technology provides Web developers with a simple, consistent mechanism for extending the functionality of a Web server and for accessing existing business systems. The Java Servlet API allows a Software developer to add dynamic content to a Web server using the Java platform. Servlets are server-side Java EE components that generate responses (typically HTML pages) to requests (typically HTTP requests) from clients. Server-side refers to operations that are performed by the server in a Client-server relationship in Computer networking. HTML, an initialism of HyperText Markup Language, is the predominant Markup language for Web pages It provides a means to describe the structure Hypertext Transfer Protocol ( HTTP) is a Communications protocol for the transfer of information on the Internet. A client is an application or system that accesses a remote service on another Computer system, known as a server, by way of a Network. A servlet can almost be thought of as an applet that runs on the server side—without a face.

// Hello. javaimport java. io. *;import javax. servlet. *; public class Hello extends GenericServlet {    public void service(ServletRequest request, ServletResponse response)             throws ServletException, IOException {        response. setContentType("text/html");        final PrintWriter pw = response. getWriter();        pw. println("Hello, world!");        pw. close();    }}

The import statements direct the Java compiler to include all of the public classes and interfaces from the java.io and javax.servlet packages in the compilation. An interface in the Java programming language is an Abstract type that is used to specify an interface (in the generic sense of the term that classes A Java package is a mechanism for organizing Java classes into namespaces similar to the modules of Modula.

The Hello class extends the GenericServlet class; the GenericServlet class provides the interface for the server to forward requests to the servlet and control the servlet's lifecycle. A server is a Computer dedicated to providing one or more services over a computer network typically through a request-response routine

The Hello class overrides the service(ServletRequest, ServletResponse) method defined by the Servlet interface to provide the code for the service request handler. An interface in the Java programming language is an Abstract type that is used to specify an interface (in the generic sense of the term that classes The service() method is passed a ServletRequest object that contains the request from the client and a ServletResponse object used to create the response returned to the client. The service() method declares that it throws the exceptions ServletException and IOException if a problem prevents it from responding to the request. Exception handling is a programming language construct or computer hardware mechanism designed to handle the occurrence of a condition that changes the normal flow of execution

The setContentType(String) method in the response object is called to set the MIME content type of the returned data to "text/html". Multipurpose Internet Mail Extensions ( MIME) is an Internet standard that extends the format of e-mail to support text in Character The getWriter() method in the response returns a PrintWriter object that is used to write the data that is sent to the client. The println(String) method is called to write the "Hello, world!" string to the response and then the close() method is called to close the print writer, which causes the data that has been written to the stream to be returned to the client.

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. JavaServer Pages ( JSP) is a Java technology that allows Software developers to dynamically generate HTML, XML or other types of documents Server-side refers to operations that are performed by the server in a Client-server relationship in Computer networking. HTML, an initialism of HyperText Markup Language, is the predominant Markup language for Web pages It provides a means to describe the structure Hypertext Transfer Protocol ( HTTP) is a Communications protocol for the transfer of information on the Internet. A client is an application or system that accesses a remote service on another Computer system, known as a server, by way of a Network. JSPs embed Java code in an HTML page by using the special delimiters <% and %>. A delimiter is a sequence of one or more characters used to specify the boundary between separate independent regions in Plain text or other data stream 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.

Swing application

Main article: Swing (Java)

Swing is a graphical user interface library for the Java SE platform. Swing is a Widget toolkit for Java. It is part of Sun Microsystems ' Java Foundation Classes (JFC &mdash an API for providing In Computer science, a library is a collection of Subroutines used to develop Software. 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. In Computing, a window is a visual area usually rectangular in shape containing some kind of User interface, displaying the output of and allowing input for one In Computing, the title bar (or titlebar) consists of that part of a window where the title of the window appears In computer programming a widget (or control) is an element of a Graphical user interface (GUI that displays an information arrangement changeable by the user

The Hello() constructor initializes the frame by first calling the superclass constructor, passing the parameter "hello", which is used as the window's title. In Object-oriented programming, a constructor (sometimes shortened to ctor) in a class is a special block of statements called when an object is created 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. Layout managers are software components used in Widget toolkits which have the ability to lay out widgets by their relative positions without using distance units 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. In its simplest embodiment an object is an allocated region of storage 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. The event dispatching thread (EDT is a background thread used in Java to process events from the Abstract Windowing Toolkit (AWT Graphical user interface

Criticism

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. The Java programming language was intended to serve as a novel way to manage software complexity though a number of criticisms have been leveled at the language Programs written in Java have had a reputation for being slower and requiring more memory than those written in natively compiled languages such as C or C++ (see In Computing, just-in-time compilation ( JIT) also known as dynamic translation, is a technique for improving the runtime performance of a Computer [17][18][19] 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. Look and feel is a term used in descriptions of products and fields such as Marketing, Branding and Trademarking to signify the experience a person has using Swing is a Widget toolkit for Java. It is part of Sun Microsystems ' Java Foundation Classes (JFC &mdash an API for providing It is possible to specify a different look and feel through the pluggable look and feel system of Swing. Pluggable look and feel is a mechanism used in the Java Swing Widget toolkit allowing to change the look and feel of the Graphical user Clones of Windows, GTK and Motif are supplied by Sun. Microsoft Windows is a series of Software Operating systems and Graphical user interfaces produced by Microsoft. GTK+, or The GIMP Toolkit, is a Cross-platform Widget toolkit for creating Graphical user interfaces It is one of the most popular toolkits In computing Motif refers to both a Graphical user interface (GUI specification and the Widget toolkit for building applications that follow that specification Apple also provides an Aqua look and feel for Mac OS X. Apple Inc, ( formerly Apple Computer Inc, is an American Multinational corporation with a focus on designing and manufacturing Consumer electronics Aqua is the Graphical user interface and primary visual theme of Apple Inc Mac OS X (mæk oʊ ɛs tɛn is a line of computer Operating systems developed marketed and sold by Apple Inc, the latest of which is pre-loaded on all currently Though prior implementations of these looks and feels have been considered lacking, Swing in Java SE 6 addresses this problem by using more native widget drawing routines of the underlying platforms. In computer programming a widget (or control) is an element of a Graphical user interface (GUI that displays an information arrangement changeable by the user Alternatively, third party toolkits such as wx4j, Qt Jambi or SWT may be used for increased integration with the native windowing system. Qt (pronounced "cute" by its creators is a Cross-platform application development framework widely used for the development of GUI programs (in which The Standard Widget Toolkit ( SWT) is a graphical Widget toolkit for use with the Java platform.

As in C++ and some other object-oriented languages, variables of Java's primitive types were not originally objects. In Computer science, primitive types — as distinct from Composite types ' — are Data types provided by a Programming language as basic 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). Stacks in computing architectures are regions of memory where data is added or removed in a Last-In-First-Out manner In programming language Compiler optimization theory escape analysis is a method for determining the dynamic scope of Pointers It is related to Pointer 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. In Computer science, an object type (aka wrapping object is a Datatype which is used in Object-oriented programming to wrap a non-object

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. In Computer programming, operator overloading (less commonly known as operator Ad-hoc polymorphism) is a specific case of polymorphism in Multiple inheritance refers to a feature of some object-oriented Programming languages in which a class can inherit behaviors and features from This has been a source of criticism, relating to a lack of low-level features, but some of these limitations may be worked around. Java interfaces have always had multiple inheritance.

Resources

Java Runtime Environment

The Java Runtime Environment, or JRE, is the software required to run any application deployed on the Java Platform. A Java Virtual Machine ( JVM) is a set of computer software programs and data structures which use a Virtual machine Application software is a subclass of Computer software that employs the capabilities of a computer directly and thoroughly to a task that the user wishes to perform End-users commonly use a JRE in software packages and Web browser plugins. Economics and Commerce define an end-user as the person who uses a product. 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. A software development kit ( SDK or " devkit " is typically a set of development tools that allows a Software engineer to create applications A Java compiler is a Compiler for the Java programming language. Javadoc is a Documentation generator from Sun Microsystems for generating API documentation in HTML format from Java source code In Computing, a JAR file (or J ava AR chive is used for aggregating many files into one A debugger is a Computer program that is used to test and Debug other programs

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. Automated Exception Handling is a Computing term referring to the computerized handling of errors

Components

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. Java Database Connectivity (JDBC is an API for the Java programming language that defines how a client may access a Database. The Java Naming and Directory Interface ( JNDI) is a Java API for Directory service that allows Java software clients to discover and look up data and objects The Java Remote Method Invocation API, or Java RMI, is a Java application programming interface for performing the object equivalent of Remote procedure The Common Object Requesting Broker Architecture (CORBA is a standard defined by the Object Management Group (OMG that enables software components written The user interface (or Human Computer Interface) is the aggregate of means by which people&mdash the users '&mdash interact with the System The term native mode is used in Computing in two related senses The Abstract Window Toolkit (AWT is Java 's original platform-independent windowing, Graphics and User-interface Widget toolkit. Swing is a Widget toolkit for Java. It is part of Sun Microsystems ' Java Foundation Classes (JFC &mdash an API for providing A Java Virtual Machine ( JVM) is a set of computer software programs and data structures which use a Virtual machine A Java applet is an Applet delivered in the form of Java bytecode. A web browser is a software application which enables a user to display and interact with text images videos music games and other information typically located on a Java Web Start is a framework developed by Sun Microsystems which allows Application software for the Java Platform Economics and Commerce define an end-user as the person who uses a product. The Internet is a global system of interconnected Computer networks Free Java implementations are software projects that implement Sun Microsystem's Java technologies and are distributed under Free software licences, thus making them The platforms are:

The classes in the Java APIs are organized into separate groups called packages. In Object-oriented programming, a class is a Programming language construct that is used as a blueprint to create objects This blueprint includes attributes A Java package is a mechanism for organizing Java classes into namespaces similar to the modules of Modula. Each package contains a set of related interfaces, classes and exceptions. An interface in the Java programming language is an Abstract type that is used to specify an interface (in the generic sense of the term that classes Exception handling is a programming language construct or computer hardware mechanism designed to handle the occurrence of a condition that changes the normal flow of execution 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. The Java Community Process or JCP, established in 1998, is a formalized process which allows interested parties to be involved in the definition of future versions Companies or individuals participating in this process can influence the design and development of the APIs. This process has been a subject of controversy.

See also

Notes

  1. ^ The Java Language Environment (May 1996). Programming languages are used for controlling the behavior of a machine (often a Computer) This is a comparison of the C# programming language with the Java programming language. Groovy is an object-oriented Programming language for the Java Platform as an alternative to the Java programming language. Jython, successor of JPython, is an implementation of the Python programming language written in Java. Pnuts is a dynamic scripting language for the Java Platform. It is designed to be used in a dual language system with the Java programming language. Join Java is a Programming language that extends the standard Java programming language with the Join Semantics of the Join Calculus. JavaOne is an annual conference (since 1996) put on by Sun Microsystems to discuss Java technologies primarily among Java developers The Javapedia project was launched in June 2003 during the JavaOne developer conference See also Integrated development environment The following tables list software packages that are nominal IDEs standalone tools such as Source code editors and This article provides non-exhaustive lists of J2SE Java virtual machines (JVMs There are three types of Java Programming Language Application Programming Interfaces (APIs: the official core Java API contained in the JDK or This is a list of some Scripting languages available for the Java platform the Bean Scripting Framework (BSF BeanShell The Java Posse is a Podcast of news discussion and interviews about the Java programming language and associated Java technologies The Java language has undergone several changes since JDK 10 as well as numerous additions of classes and packages to the standard library. Swing is a Widget toolkit for Java. It is part of Sun Microsystems ' Java Foundation Classes (JFC &mdash an API for providing C# (pronounced C Sharp is a Multi-paradigm
  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. For each (or foreach) is a Computer language idiom for traversing items in a collection. In Computer science, an object type (aka wrapping object is a Datatype which is used in Object-oriented programming to wrap a non-object An annotation, in the Java computer programming language, is a special form of syntactic Metadata that can be added to Java source code C# (pronounced C Sharp is a Multi-paradigm [1][2]
  4. ^ Jon Byous, Java technology: The early years. Sun Developer Network, no date [ca. 1998]. Retrieved April 22, 2005. Events 1500 - Portuguese Navigator Pedro Álvares Cabral becomes the first European to sight Brazil. Year 2005 ( MMV) was a Common year starting on Saturday (link displays full calendar of the Gregorian calendar.
  5. ^ http://blogs.sun.com/jonathan/entry/better_is_always_different.
  6. ^ Heinz Kabutz, Once Upon an Oak. Artima, Retrieved April 29, 2007. Events 1429 - Joan of Arc arrives to relieve the Siege of Orleans. Year 2007 ( MMVII) was a Common year starting on Monday of the Gregorian calendar in the 21st century.
  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. ^ Stroustrup: C++ Style and Technique FAQ
  15. ^ Using the applet Tag (The Java Tutorials > Deployment > Applets)
  16. ^ Deploying Applets in a Mixed-Browser Environment (The Java Tutorials > Deployment > Applets)
  17. ^ Performance of Java versus C++, J. P. Lewis and Ulrich Neumann, Computer Graphics and Immersive Technology Lab, University of Southern California
  18. ^ The Java is Faster than C++ and C++ Sucks Unbiased Benchmark
  19. ^ FreeTTS - A Performance Case Study, Willie Walker, Paul Lamere, Philip Kwok

References

External links


© 2009 citizendia.org; parts available under the terms of GNU Free Documentation License, from http://en.wikipedia.org
Dapyx Software network: MP3 Explorer | Ebook Manager | Zenithic