Powered by Blogger.

What is Java?

Java is a computer programming language that is used to build softwares. It is also an application, development, and deployment environment. Java is object oriented programming language to help us visualize the program in real-life terms. The syntax of Java is similar to C and C++ based language. Java applications are typically compiled to bytecode (class file) that can run on any Java Virtual Machine (JVM) regardless of computer architecture.

Brief History of Java

In 1990, Sun Microsystems began a research project named Green to develop the C and C++ based language. James Gosling, a network software designer was assigned to this project. Gosling’s solution to the problems of C++ was a new language called Oak after an oak tree outside his window at Sun. In May 1995, Sun Microsystems formally announced Java (Oak was renamed Java). Finally, in 1996, Java arrived in the market as a programming language.

With the advent of Java 2 (released initially as J2SE 1.2 in December 1998), new versions had multiple configurations built for different types of platforms. For example, J2EE targeted enterprise applications and the greatly stripped-down version J2ME for mobile applications (Mobile Java). J2SE designated the Standard Edition. In 2006, for marketing purposes, Sun renamed new J2 versions as Java EE, Java ME, and Java SE, respectively.

On November 13, 2006, Sun released much of Java as free and open source software, (FOSS), under the terms of the GNU General Public License (GPL). On May 8, 2007, Sun finished the process, making all of Java’s core code available under free software/open-source distribution terms.


Table: Major Release Versions of Java.

Version
Date
JDK 1.0
January 23, 1996
JDK 1.1
February 19, 1997
J2SE 1.2
December 8, 1998
J2SE 1.3
May 8, 2000
J2SE 1.4
February 6, 2002
J2SE 5.0
September 30, 2004
Java SE 6
December 11, 2006
Java SE 7
July 28, 2011

What is Java Applets?

Applets are Java programs that reside on web servers, download by a browser to a client’s computer and run by that browser. Applets are usually small in size to minimize download time and are invoked by a Hypertext Markup Language (HTML) web page.

Java Virtual Machine (JVM)

A Java virtual machine is a software that is capable of executing Java bytecode. Code for the JVM is stored in .class or .jar files, each of which contains code for at most one public class. JVM enables the Java application to be platform independent. JVM is distributed along with a set of standard class libraries that implement the Java application programming interface (API). JVM mainly performs three tasks:

Loads Code The class loader loads all classes needed for the execution of a program.

Verifies Code The byte code verifier tests format of code fragment and checks code fragments for illegal code, which is code that forges pointers, violates access rights on objects, or attempts to change object type.

Execute Code Performed by the runtime interpreter.

The Java Runtime Environment(JRE) is an implementation of the Java Virtual Machine (JVM), which actually executes Java programs. The Java Development Kit (JDK) is the original Java development environment for Java programmers. The JDK consists of a library of standard classes and a collection of utilities for building, testing, and documenting Java programs.

Java Automatic Memory Management | Java Coding

Automatic Memory Management:

Many programming languages like C and C++ permit the memory to be allocated dynamically at runtime. After the allocated memory is no longer required, the program or runtime environment should de-allocated the memory. If the program does not de-allocate the memory that can crash eventually when there is no memory left for the system to allocate. These types of programs are said memory leaks. Java overcome this problem by using garbage collection. It provides a system level thread that tracks each memory allocation. During idle cycles in the JVM, the garbage collection thread checks for and frees any memory the can be freed in the object lifecycle.

Access control refers to exerting control over who can interact with a resource | java

Access Control Refers:

Access control refers to exerting control over who can interact with a resource. Often but not always, this involves an authority, who does the controlling. The resource can be a given building, group of buildings, or computer-based information system. But it can also refer to a restroom stall where access is controlled by using a coin to open the door.[citation needed]

Access control is, in reality, an everyday phenomenon. A lock on a car door is essentially a form of access control. A PIN on an ATM system at a bank is another means of access control. The possession of access control is of prime importance when persons seek to secure important, confidential, or sensitive information and equipment.[citation needed]

Item control or electronic key management is an area within (and possibly integrated with) an access control system which concerns the managing of possession and location of small assets or physical (mechanical) keys.[citation needed]


The Collection API of Java Platform | List of Java APIs

Introduction of API:-

As the name indicates, collections is a group of objects known as its elements. Basically it is a package of data structures that includes Array Lists, Linked Lists, Hash Sets, etc. A collection is simply an object that groups multiple elements into a single unit. It is also called as a container sometimes. It is used to store, retrieve, manipulate, and communicate aggregate data. Typically, it represents data items that form a natural group and allows duplicate elements while others do not. It consists of both ordered and unordered elements. There is no direct implementation of this interface however SDK provides implementations of more specific sub interfaces like Set and List. The manipulation and passing of collections is done by this interface.

The Two "standard" constructors should be provided by all the general-purpose Collection implementation classes. These classes typically implement Collection indirectly through one of its sub interfaces.

   1. Void (no arguments) constructor which creates an empty collection.

   2. Constructor with a single argument of type Collection, which creates a new collection with the same elements as its argument.

The user can copy any collection using void constructor to produce an equivalent collection of the desired implementation type. As interfaces cannot contain constructors there is no way to enforce this convention. However all of the general-purpose Collection implementations comply this in the Java platform libraries.

The Java Collections API:

Java Collections of API (Application Programming Intreface) Consists of several interfaces, and classes that implement those interfaces, within the java.util package. It provides tools for maintaining a data container of objects. Each primitive value must be wrapped in an object of its appropriate wrapper class (Boolean, Character, Integer, Double, etc.) to maintain a collection of primitive data. It is an alternative tool to the creation of custom data structures.

You must be familiar with collections if you have worked with Java programming language. Collection implementations included Vector, Hashtable, and array are available in earlier (pre-1.2) versions of the Java platform, but those versions do not include the collections framework. Hence the new version of the Java platform contains the collections framework.

The Collection API:-

A collection is a single object representing a group of objects. The objects in the collection are called elements. Implementation of collection determine whether there is specific ordering and whether duplicates are permitted.

1. Set An unordered collection, where no duplicates are permitted.

2. List An ordered collection, where duplicates are permitted.

1  import java.util.*;
2
3  public class SetExample{
4    public static void main(String[]agrs){
5      Set set = new HashSet();
6      set.add(”One”);
7      set.add(”2nd”);
8      set.add(”3rd”);
9      set.add(new Integer(6));
10     set.add(new Float(7.7F));
11     set.add(”2nd”); // duplicate are not added
12     System.out.println(set);
13   }
14 }

1  import java.util.*;
2
3  public class ListExample{
4    public static void main(String[]agrs){
5      List list = new ArrayList();
6      list.add(”One”);
7      list.add(”2nd”);
8      list.add(”3rd”);
9      list.add(new Integer(6));
10     list.add(new Float(7.7F));
11     list.add(”2nd”); // duplicate is added
12     System.out.println(list);
13   }
14 }

Related Tags for Introduction to Collections API:

c, array, list, collections, data, hash, object, lists, io, objects, include, struct, link, collection, arraylist, structure, sets, name, package, set, element, includes, group, basic, elements, call, hashset, ical, sh, e, it, des, structures, li, in, no, cal, as, m, nt, tr, ca, linked, j, pack, cl, es, sts, em, all, age, me, obj, ack, cat, s, col, at, pac, k, inc, is, ink, ha, ll, collect, ray, ar, collect, str, s, s, th, st, hat, cts, etc, etc, indic, je, ica, ica, nd, on, ol, o.