Posts

Introduction to JAVA ( Basic )

                                                - The Creation  - The java was created by James Gosling , Patrick Naughton ,            Chris  Warth , Ed Frank  and Mike Sheridan at Sun Microsystems    , Inc. in  1991 . This language was initially named as "oak" but         was  renamed " java " in 1995 .  - The basic reason that lead to the creation of java was NOT               internet  , but was the need of a platform independent language      that could be used to create software to be embedded in various     consumer electronic devices such as Microwave Ovens , Remote     Controls etc .   - The trouble with C , C++ is that they are designed to be                    compiled for a specific target . Although it is possible to                  compile  a C++ program for just about any type of CPU  , to do        so it   requires a full C++ compiler targeted for that CPU.  - The problem is that Compilers are expensive and time      consuming to create.

Packages in Java

  Packages  - The main feature of java is reusability  of code. Resuability is achieved by extending classes or implementing interfaces.  - But this is limited to only that respective class , i.e if we want to use code in same program. If we want to use code in different programs, this is done via Packages.  - Packages are the Java's way of grouping a variety of classes or interface together.  - The grouping is usually done according to functionality.   Advantages 1. Packages of other programs can be easily reused. 2. The classes in 2 different packages can have same name. 3.They provide a way to "hide" classes that are meant for internal use only. 4. Separates "Design" from "Coding".  Defining a Package   The package can be defined as:                           package package_name;   we can also declare sub-packages as:             package package1[[.package 2][.package 3]];   (# Note: The braces are used to separating