Deva Point

deva point

Our Latest Programming Tutorial

Easy To Learning

Complete History of Java Programming

Java was developed in the 1990s by James Gosling and Sun Microsystems colleagues. Contrary to conventional languages, which are usually designed to either be compiled to machine code (native) or to be interpreted at runtime from source code, Java is not one of these.

History of Java Programming

James Gosling started Java in June 1991 as an “Oak” project. Gosling wanted to create a virtual machine, a language with a C-like syntax but more uniformity and simplicity than C/C++. Java 1.0 was the first to be released in 1995. It promised “Write Once, Run Anywhere”, and free runtimes for popular platforms. It was quite secure, and it was configurable to limit network and file access.

It was quickly integrated into the major web browsers’ standard configurations as an “applet” configuration. popular quickly. With the release of Java 2, new versions were soon developed for both large and small platforms (J2EE, J2ME). Sun has not yet announced plans for a Java 3 version.

Sun approached the ISO/IEC JTC1 standards bodies and then the Ecma International in 1997 to formalize Java. However, it quickly withdrew. Java is a de facto proprietary standard, which is managed by the Java Community Process. Sun makes the majority of its Java implementations free of charge. Revenue is generated through specialized products like the Java Enterprise System. Sun differentiates between its Software Development Kit, (SDK), and Runtime Environment (JRE), which is a subset the SDK. The primary difference is that the JRE does not include a compiler.

Java was built on principles such as Robust and Portable, Platform Independent, High Performance Multithread, and others. TIME MAGAZINE named Java one of the Ten Best Products in 1995.

Java is currently used for internet programming, mobile devices and games. Since JDK 1.0, the Java Programming Language has seen a few modifications. There have also been various enhancements to the standard library and classes. The Java Class Library has seen many other changes over the years. It was originally composed of a few hundred classes, but it has grown to over three thousand in J2SE 5.

Sun Microsystems published Java 1.0’s first public implementation in 1996. [27] It promised Write Once and Run Anywhere functionality. This function provided no-cost run-times for popular platforms. It was fairly secure, with configurable security. It allowed file- and network access restrictions. Java quickly gained popularity and was soon integrated into major web browsers.

Arthur van Hoff rewrote the Java 1.0 compiler in Java to conform with the Java 1.0 language specifications. [28] Java 2 was released in December 1998 as J2SE1.2. It had multiple configurations for different platforms.

J2EE contained technologies and APIs that are used in enterprise applications. J2ME was optimized for mobile applications. J2SE was the new name for the desktop version. Sun renamed the J2SE desktop version in 2006 for marketing purposes.

Philosophy

The creation of Java was based on five main goals:

1. It should follow the object-oriented programming method.

2. It should permit the same program to run on multiple operating systems.

3. It should include built-in support to use computer networks.

4. It should be able to securely execute code from remote sources.

5. It should be simple to use, by choosing what is considered the best parts of object-oriented languages.

Java programmers may need to use extensions like CORBA (Internet Communications Engine) or OSGi in order to achieve remote code execution and networking support.

Platform Independence

Platform independence is the second characteristic. Programs written in Java must work on different hardware. It should be possible to create a program once, and then run it on any device.

This is achieved by most Java compilers by compiling the Java language code “halfway” to bytecode (specifically Java bytecode)–simplified machine instructions specific to the Java platform. The code is then executed on a virtual machine, a program written in native on the host hardware. It interprets and executes generic Javabytecode.

Standardized libraries allow for unified access to host machine features (such as graphics and threading) by providing standardized libraries. Although there is an explicit compilation stage, the Javabytecode is converted by the JIT compiler to native machine instructions at some point.

There are also Java compilers that compile native object code (GCJ), removing the intermediate bytecode step. However, these compilers cannot be run on more than one architecture.

Sun’s Java license insists on all Java implementations being “compatible”. After Sun claimed that the Microsoft Java implementation didn’t support the RMI or JNI interfaces, and had added platform-specific features to their own implementations, this led to a legal dispute between Microsoft and Sun. Microsoft responded by removing Java from Windows. Internet Explorer in the latest versions of Windows cannot support Java applets unless it has a third-party plugin. Sun and other companies have made Java run-time software available at no cost to those versions and all others.

To achieve portability, the first implementations used an interpreted virtual computer. The implementations resulted in programs that ran slower than programs compiled to native executables. This led to a bad reputation for the language. Multi-tracking techniques have allowed JVM implementations to produce programs that run much faster than they did before.

First, compile directly into native code using a traditional compiler. This eliminates bytecodes completely. This is a good way to achieve high performance but it does not allow for portability. Another technique is called just-in-time compiling (JIT). This converts Java bytecodes to native code at run time. It results in a program which executes faster than interpreted, but incurs overhead during execution.

Dynamic recompilation is a more advanced VM that can analyze and optimize the program’s behavior and recompile or optimize the most critical sections. Because dynamic recompilation is able to base optimizations on knowledge of the runtime environment as well as the set loaded classes, dynamic recompilation can achieve better optimizations than static compilation. Java programs can benefit from native code speed without losing portability with dynamic recompilation and JIT compilation.

Portability is technically a difficult goal to attain, and Java’s failure at this goal has been mixed. It is possible to create Java programs that work across multiple platforms. However, there are many platforms available with minor errors and inconsistencies. This led to some people parodying Sun’s “Write one, run anywhere” slogan by saying “Write one, debug everywhere”.

However, platform-independent Java works well with server-side apps such as Web services and Enterprise JavaBeans. It also works well with embedded systems based upon OSGi that use Embedded Java environments.

Garbage Collection by Automatic

Java’s automatic memory management model was designed to save programmers the effort of manually managing memory. Some languages allow the programmer to allocate memory for creating any object on the heap. Later, he or she will manually deallocate that memory to delete such objects. A memory leak is when a programmer fails to allocate memory correctly or writes code that does not do so timely. The program could end up consuming an arbitrarily high amount of memory.

A program that dealslocates memory twice can cause instability and even crash. In non-garbage collected environments, there are some overheads and complex user-code required to track and finalize allocations.

Automatic garbage collection in Java solves this problem. The Java runtime manages the object’s lifecycle. It is the programmer who determines when objects will be created. A reference is a way for program and other objects to reference an object. This refers to the address of the object on the heap. The Java garbage collector deletes all references to an object when there are none. This frees memory and prevents memory leaks. If a programmer has a reference to an object in their code, memory leaks can still happen. In other words they can still happen but at higher conceptual levels.

Programming paradigms can be affected by garbage collection. 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. This allows for thread isolation (no need for synchronization as different threads work with different objects) and data-hiding at a small price. Side-effect programming is minimized by the use of transient immutable values-objects.

C++ and Java can both implement similar functionality. C++ can also be used to create memory management models for specific classes to increase speed and reduce memory fragmentation. However, this comes at the cost of additional development time and application complexity. Java garbage collection is integrated and almost invisible to developers.

This means that developers might not know when garbage collection will occur, as it may not correlate with the actions they have written. This can be advantageous or detrimental depending on the intended application: The programmer is no longer required to perform low-level tasks and has the option to write lower-level code.

Syntax

C++ is the main source of Java’s syntax. Java, however, is largely derived from C++. C++ combines the syntax of structured, generic and object-oriented programming. Java was designed from the ground up with the exception of atomic datatypes (ordinal, real, and boolean numbers and characters). Everything in Java is written within a class.

Applet

Java applets can be programs embedded in other applications. They are typically found in Web pages displayed in a Web browser.

This applet will draw the string “Hello world!” The rectangle in which the applet will run. This is a better example of Java’s OO features, as the class extends the basic.

A HTML document can be used to place an applet.HTML element. The applet tag contains three attributes: code=”Hello”, which specifies the Applet class name, and width=”200″, height=”200″, which sets the applet’s pixel width and hight. Applets can also be embedded in HTML via the embed or object element. However, support for these elements by Web browsers may not always work.

Servlet

Java servlets, server-side Java EE components, are able to generate responses to client requests.

The import statements instruct the Java compiler that all interfaces and public classes from the java.io packages should be included in the compilation. Hello extends the GenericServlet Class; GenericServlet provides an interface that allows the server to forward requests and manage the servlet’s lifecycle.

The Hello class overrides the service(ServletRequest, ServletResponse) method defined by the Servlet interface to provide the code for the service request handler. The service() method receives a ServletRequest object containing the client’s request and a ServletResponse objects used to create the client’s response. If a problem is encountered, the service() method will throw the exceptions ServletException or IOException.

The setContentType(String) method in the response object is called to set the MIME content type of the returned data to “text/html”. The response object returns a PrintWriter object. This object is used to write data to the client. To write “Hello, world!” the println(String method is called. string to the response, and then the close() method to close the print writer. This causes the data written to the stream to return to the client.

The import statement tells Java compiler to include all interfaces and public classes from the javax.swing packages in the compilation. Hello extends the JFrame Class; the JFrame implements a title bar and close control window.

The Hello() constructor initializes the frame by first calling the setDefaultCloseOperation(int) method inherited from JFrame to set the default operation when the close control on the title bar is selected to WindowConstants.DISPOSE_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, a new JLabel for the string “Hello world!” is created. The add(Components) method, inherited from Container superclass, is used to add the label to a frame. The Pack() method, inherited from Window superclass, is used to size and arrange the contents of the window.

When the program starts, the JVM calls the main() method. It creates a new Hello frame by calling setVisible(boolean), which is inherited from Component superclass and with the boolean parameter false. Exiting the main method doesn’t cause the program to end once the frame has been displayed. The AWT event dispatching thread is still active until all Swing top-level windows are disposed.

Rich set of APIs

Java is the dominant language in the category of programming interfaces rich app programming interfaces (APIs). Programmers have the option to create popular development projects using a variety Java APIs, without having to add any code. These APIs may be shared by large corporations. Others can be downloaded by members of the community. Developers can link data, inputs and outputs according to their requirements using APIs. These APIs can be combined with other Java Open Source Libraries to enhance the functionality and efficacy of an application.

Take a look and feel

GUI applications written in Java with the Swing toolkit have a default look and feel that is quite different to native applications. You can specify a different look or feel using the pluggable feel system in Swing. Sun also offers clones for Windows, GTK, and Motif. Apple also offers an Aqua look for Mac OS X. Swing in Java SE 6 fixes this issue by using native widget drawing routines from the underlying platforms. Third-party toolkits like SWT or wx4j may also be used to integrate with the native windowing system.

Java Runtime Environment

Java Runtime Environment, or JRE, is required to run any Java Platform application. A JRE is commonly used by end-users in software packages and Web browser plug-ins. Sun also distributes the Java 2 SDK, a superset, of the JRE (more commonly known by the JDK), that includes tools like the Java compiler, Javadoc and debugger.

Published
Categorized as Java

Leave a comment

Your email address will not be published. Required fields are marked *