Java
JAVA is both platform independent and architectural neural.

Platform: It is an operating system, it is a software system which will provide very environment to design and execute applications.

Platform dependent technologies:
These are the technologies which should require the same platform to compile and execute an application.
Eg : c , c++ , pascal

Platform independent technologies:
These are the technologies, which will allow its applications to compile on one operating system and to execute on another operating system. EG : java , .net , ....
Here, java is platform independent
JVM (java virtual machine) is platform dependent.

Architecture:
The hierarchy of hardware components is called as architecture .
Eg : Apple architecture , IBM , Sun sparks
Architectural dependent technologies : they are the technologies which should require same architecture to compile and execute an application . Eg : c , c++
Architectural independent technologies :they are the technologies which will allow a separate architecture for compilation and different architecture for execution .
Eg : java
Java is architecutural neutral technology due to the availability of JVM . Here , JVM is architectural dependent .

HISTORY :
  • JAVA TECHNOLOGY :
  • Home : Sun Micro system
  • Project : Green Project
  • First Version : jdk 1.0 (1996)
  • Rapid Change : jdk 2.0 , jdk 5.0
  • Used Version : jdk 5.0 , jdk 6.0
  • Latest Version : jdk 7.0
  • Author : James Goslie
  • Open/licensed : open source software
  • Objective : simple , tightcodes , Archetetural neutral
  • Strong Features : Object Oriented , platform independent , architectural neutral ,portable, exception handling mechanism, robust


JAVA FEATURES:

Like c, c++ technologies java is also having its rich set of features :
Simple: java is a simple technology because it doesn't allow the rarely used concepts and confusing concepts from c , c++ . more ever , Java uses Hungarian language styled syntaxes in Java applications .
Object oriented: java is an object oriented technology , because in java technology data could be represented in the form of objects.
Platform independent: it is possible to compile java application on one platform and it is possible to execute the same java application and another platform, that is why , java is P.I technology.
Architectural neutral: it is possible to compile java application on one architecture and also possible to execute the same Java application on another architecture. So, that java is Architectural neutral technology.
Security: Java technology is using a separate component to implement security policies called as Security manager inside JVM . More ever, Java provides very good predefined library to implement the explicit security mechanisms like Encryption algorithms , description algorithm and so on.
Portable :it was already proven that java technology is platform independent and architecture neutral . so ,that java technology is more portable.
Robust : if any technology is good in exception handling and memory management then that technology is robust technology. Java is robust technology because Java is having very good predefined library to handle exceptions and Java is having very good memory management system in the form of Heap memory to allocate and deallocate objects at run time.
Dynamic : in any technology the memory allocation is going on at compile time then that technology is called static technology .In any technology if the memory allocation is going on at run time then that technology is called as Dynamic technology .
Java is dynamic technology , because in java technology objects are created at run time , i.e. , memory allocation is going on run time.
Multi threading : a flow of execution to complete a atsk is called a thread . Java is multi-threaded , because Java provides a good environment to create and execute more than one thread at a time , in order to complete multiple task.
Interpretive : Java is both compilative and interpretive , because to compile a java program it requires Javac compiler and to execute a java program it requires an interpreter as part of the JVM.
High performance : If any technology is having these many features then that technology is a high performance technology.

Distributed

Java programming format :
To design any java application we should use the following structure :
Comment section --  optional
Package section --        “
Import section --          “
Classes/interfaces --       “
Main class – mandatory

1.Comment section --  this section is optinal in Java programming format , this section can be used to provide the description about  the application like – Author name , objective , project Name , Module name, team name, start date , expected date to compile and so on .
 2.Package section – the main purpose of packages in java applications is to improve modularity . Collection of related classes and interfaces is called as a package.In general, package name should be unique to achieve this we should use reverse name of the organization.
Eg : package packagename;
3.Import section – it is used to make the availability of classes and interfaces from one package to the present java file.
Syntax : import package path;
In general, in java applications it is possible to use only one package declaration statement . But it is possible to provide multiple import statements .
 4.Classes/interfaces – In java applications there is no limitation to provide classes and interfaces , we can provide many number of classes and interfaces with the respective implementations as per the application requirement.
5.Main class – in general, to start up  application  execution  we  require  main  method  in  java  technology  we  should  provide  main  method  in  aparticular  class  called  as  main  class.
In  general,  in  java  application  it  is  suggested  to  deciare  main  method  class  public.

Java  Naming  convention:
        Java  is  strictly case case sensitive language , i.r. , there is a separate meaning for lower case and capital letters. To provide java naming conventions java technology has provided the following five principles :

*java class names,abstract class , interface names should start witha capital letter.
STEPS TO DESIGN FIRST JAVA APPLICATION :
*SELECT an editor
*write and save java program
*compile java program
*execute java program
1. Editor : it is tool which provide very good environment to write a java program.
                Eg : textpad , Notepad , editplus..
2. Write and save java program :
 class First
{
 public static void main(String arg[])
{
 System.out.println(“hello world “);
}
}
--To save a java program we should use the following two rules :
If we declare any class or abstract class or an interface as public then we should save that java file with public class name or public abstract   class name or public interface name .
                If we have not declared any class or an abstract  class or an interface as public then it is possible to save that java file with any name . In the later case it is suggestable to save the java file with main method class name .
In java environment we are able to get only three types of files :
*’.java’ file : when we save java file first time
*’.bak’ file : when we resave the same java file
*’.class’ file : when we compile the java file
3.COMPILE java program :
If we want to compile a java program we should use the following command on the location  where the java file is saved.
d:work>javac filename.java    <-|
when we use the above command on command prompt operating system will pickup javac command and searches for javac in its predefined command lists. If it is not available operating system will go for path environment variable referred locations to get javac program.
                Even in path environment variable referred locations also, if javac program is not available then operating system will display the message like.
                Javac is not recognized as an internal or external command operable program or batch file.
When we install java software on operating system first we should set path environment variable to bin folder of jdk software.
To set path environment variable temporarily we can use the following command on commad prompt.
D:\work>set path=%path%;c:\java\jdk 1.6.0\bin;
To set path envorinment variable permanently we should use the following directions.
Right click on ‘ My Computer’  à  ‘properties’ à select  ‘Advanced ‘ tab à click on ‘envorinment variable’ à  in the user variable click on ‘ New’ button à click twice on ‘ok’ button
After setting path environment variable to bin location of jdk software then operating system will identify javac operable program in jdk software .
When operating system identifies javac operable program then operating system will execute it by this java compiler will come into the picture. Java compiler will pickup  ‘ .java ‘ file name provide along with javac command and search for the respective java file in the current location .
If the specified java file is not available in the current location then java compiler will display the following message :  javac : FILE NOT FOUND : FILE NAME.JAVA
IF JAVA COMPILER IDENTIFIES THE Provided java file at the specified  location then java compiler will start compilation from starting point of the file to ending point of the file . If we have any compilation errors in a source file then java compiler will display those error messages otherwise it generates  ‘ .class ‘ file.
The number of  ‘ .class ‘ file generated is completely depends on the number of classes , number  of interfaces ,number of abstract classes and number of inner classes which we used in java file.
In the above process by default all the  ‘ . class’ files are stored in the current  location from where we compiled the java file.
As per the requirement if we want to send the generated ‘. Class’ fils to some other location we should use the following command on command prompt.
Syntax :  cmd> javac –d targetlocation sourcefile
4.Execute java program :
To execute a java program we should use the following command prompt , at the location where we have main method class’s ‘ .class’ file.
Syntax :cmd> java <main method class name>
                If we use the above command on command prompt then operating system will pickup javacommand and searches for it in its predefined commands and searches for it in its predefined commands lists , if it is not available

Variable nameidual
©2011 All Rights reserced. Web Arc Solutions