Introduction To Java Programming language


 Introduction To Java Programming language
Software is a development process which converts the imaginaries into reality by writing
comes set of programs.

In IT we develop two types of applications. They are stand alone applications and distributed applications.
A stand alone application is one which runs in the context of local disk. All stand alone applications are not sharable. S ystem software and application software come s under stand alone applications.
In  IT  we  develop two  types  of  applications. They  are  stand  alone  applications and  distributed applications.
A   stand  alone   application   is   one   which  runs   in   the   context   of   local   disk.   All   stand  alone applications  are  not  sharable.  System  software and application  software  comes  under stand  alone applications.
System  software  is  used  for  developing  functionality  of  hardware  devices.  Examples  are  C and ALP (Assembly Language Programming).
Application software is used for developing organizations oriented applications. This is also known  as  backend  software’s.  Examples  are  dbase,  dbase  III  plus,  FoxPro,  oracle  versions released till now.
Internet software is used for developing distributed applications.

A distributed application is one which can be accessed across the globe. Distributed application is also one which runs in the con test of the World Wide Web. To develop distributed applications we must use client-server architecture.

In client-server architecture we must hare at least two programs they are client program and server program. A client progra m is one which always makes a request to get the service from the server. A server program is on e which will do three operations receiving the request from client, processing the client request and sending the response to the client.
All the above three operati ons are performed by the server concurrently. In order to exchange the data between client and server we must use a protocol called http (hypertex t transfer protocol).

Protocol is a set of values which are defined to exchange the data betwe en client and server either locally or remotely.

In order to develop distrib uted applications, two software companies c ame forward whose names are Microsoft System and Sun Micro System.


Microsoft System has developed a technology called DOT NET and Su n Micro System has developed a technology called JAVA. Both this technologies are called distributed technologies.
The technology DOT NET will run only on that operating system’s wh ich are provided by Microsoft (as on today). Hence DOT NET technology is platform dependent tech nology. Whereas, the technology called JAVA will run on all operating system’s irrespective of their providers hence JAVA is called platform independent t echnology.



The slogan of JAVA is “Write One’s Reuse/Run Anywhere (WORA)”.
                                                            
DOT NET technology is not freely downloadable where as JAVA freely downloadable. DOT NET supports Microsoft developed design patterns (general designed patterns are not supported) whereas JAVA supports all the design patterns which are available in IT.

Design pattern is a predefined and proved rule by third party industry experts to avoid the receiving problems which are occurring in software development.


History of JAVA

JAVA is a distributed technology developed by James Gosling, Patric Naugton, etc., at Sun Micro System has released lot of rules for JAVA and those rules are implemented by JavaSoft Inc, USA (which is the software division of Sun Micro System) in the year 1990. The original name of JAVA is OAK (which is a tree name). In the year 1995, OAK was revised and developed software called JAVA (which is a coffee seed name).

JAVA released to the market in three categories J2SE (JAVA 2 Standard Edition), J2EE (JAVA 2 Enterprise Edition) and J2ME (JAVA 2 Micro/Mobile Edition).

i. J2SE is basically used for developing client side applications/programs.
ii. J2EE is used for developing server side applications/programs.
iii. J2ME is used for developing server side applications/programs.
If you exchange the data between client and server programs (J2SE and J2EE), by default JAVA is having on internal support with a protocol called http. J2ME is used for developing mobile applications and lower/system level applications. To develop J2ME applications we must use a protocol called WAP (Wireless Applications Protocol).
FEATURES of java:
  1. Simple
  2. Platform independent 
  3. Architectural neutral 
  4. Portable 
  5. Multi threading 
  6. Distributed 
  7. Networked 
  8. Robust 
  9. Dynamic 
  10. Secured 
  11. High performance 
  12. Interpreted Object Oriented Programming Language   


1.    Simple: JAVA is simple because of the following factors: 
 i. JAVA  is   free  from  pointers   hence  we  can  achieve  less  development  time  and  less    execution  time  [whenever  we  write  a  JAVA  program  we  write  without  pointers  and internally it is converted into the equivalent pointer program]. 
ii. Rich  set  of  API  (application  protocol  interface)  is  available  to  develop  any  complex application.
iii.The software JAVA contains a program called garbage collector which is always used to collect  unreferenced  (unused)  memory  location  for  improving  performance  of  a  JAVA program. [Garbage collector is the system JAVA program which runs in the background along with regular JAVA program to collect unreferenced memory locations by running at periodical interval of times for improving performance of JAVA applications. 
iv.JAVA contains user friendly syntax’s for developing JAVA applications.
2.    Platform Independent: 
A program or technology is said to be platform independent if and only if which can run on all available operating systems. 
The   languages   like   C,   Cpp   are   treated   as   platform   dependent   languages   since   these languages  are  taking  various  amount  of  memory  spaces  on  various  operating  systems  [the operating system dos understands everything in the form of its native format called Mozart (MZ) whereas   the   operating   system   Unix   understands   everything   in   its   negative   format   called embedded linking format (elf). When we write a C or Cpp program on dos operating and if we try to transfer that program to Unix operating system, we are unable to execute since the format of  these  operating  systems  are  different  and  more  over  the  C,  Cpp  software  does  not  contain any special programs which converts one format of one operating system to another format of other operating system]. 
The language like JAVA will have a common data types and the common memory spaces on all operating systems and the JAVA software contains the special programs which converts the format  of  one  operating  system  to  another  format  of  other  operating  system.  Hence  JAVA language is treated as platform independent language.


3.Architectural Neutral:
 A language or technology is said to be architectural neutral which can run on any available processors in the  real world. The  languages like  C, Cpp are  treated as architectural dependent. The  language  like  JAVA  can  run  on  any  of  the  processor  irrespective  of  their  architecture  and vendor. 



4.    Portable:

 A  portable  language  is  one  which  can  run  on  all  operating  systems  and  on  all  processors irrespective  their  architectures  and  providers.  The  languages  like  C,  Cpp  are  treated  as  non- portable languages whereas the language JAVA is called portable language.
  
5.    Multi Threading:  
 Definitions:
1.    A flow of control is known as thread. 
2.    A multi threaded program is one in which there exists multiple flow of controls i.e., threads. 
3.    A program is said to be multi threaded program if and only of there exists n number of sub- programs. For each and every sub-program there exists a separate flow of control. All such flow of controls are executing concurrently. Such flow of controls is known as threads. Such type of applications is known as multi threading applications. 
4.    The  languages  like  C,  Cpp  are  treated  as  threads  as  single  threaded  modeling  languages (STML). SMTL are those in which there exists single flow of control. 
5.    The  languages  like  JAVA  and  DOT  NET  are  treated  as  multi  threadedd  modeling  languages (MTML). MTML are those in which there exist multiple flows of controls. 
6.    Whenever   we   write   a   JAVA   program   there   exists   by   default   two   threads.   They   are foreground/child thread and background/main/parent thread. 
7.    A  foreground  thread  is  one  which  always  executes  user  defined  sub-programs.  In  a  JAVA program there is a possibility of existing n number of foreground threads. 
8.    A background thread is one which always monitors the status of foreground thread. In each and every JAVA program tthere exists only one background thread. 
9.    Hence background thread will be created first and later foreground thread will be created.
6.    Distributed:  
A service is a said to be a distributed service which runs in multiple servers and that service can  be  accessed  by  n  number  of  clients  across  the  globe.  In  order  to  develop  distributed applications we must require architecture called trusted network architecture. To develop these applications we require a technology called J2EE. Distributed applications are preferred by large scale organizations.
 


7.    Networked:
In  real  world  we  have  two  types  of  networks.  They  are  un-trusted  networks  and  trusted networks. 
Un-trusted networks:
A   network   is   said   to   be   un-trusted   network   in   which   there   exists   n   number   of   inter connected non-autonomous  architecture. Un-trusted network is also known as LAN. Using this network architecture, we develop centralized applications. A centralized application is one which runs  on  single  server  and  it  can  be  access  in  limited  graces.  In  order  to  develop  centralized. 

 

Trusted network: A network is said to be trusted network in which there exists n number of inter connected autonomous  architecture. Trusted network is also  known as WAN. Using this network, we can develop distributed applications. A distributed application is one which runs on multiple servers and it can be access in unlimited graces. In order to develop distributed applications we may use technology   called  J2EE  and   these   kinds of applications are  preferred by large   scale organization.


Installing and setting classpath for java

By seeing this post title you may get doubt. We already installed java and able to run programs also. Why this again? Actually i got a mail from java beginners like they are getting some problem while installing java and setting classpath on their Systems. So just a walk through regarding java installation and Setting classpath.

Let's start our java Installation:
Download Java latest version from oracle. Here i am going to install java 6.0. After downloading Double click on it. The process will start as shown in the below image.

Click on Next button
Installing and Setting Classpath for Java_JavabynataraJ_002
 The default folder will select by Java is: C:\Program Files\Java\jdk1.6.0\
Installing and Setting Classpath for Java_JavabynataraJ_003
 Here Select optional features to install from the list below image. You can change your choice of features after installation by using the Add/Remove programs utility in the Control Panel. here each Tools having option to install default feature and optionally sub features will be installed to local hard drive. you can find it in the  above image.
If you don't want to install you can select "Don't install this feature now" option.
Installing and Setting Classpath for Java_JavabynataraJ_004
 Jdk and Jre both will be installed in two steps.
Installing and Setting Classpath for Java_JavabynataraJ_005
 Click on Next button.
Installing and Setting Classpath for Java_JavabynataraJ_006

Installing and Setting Classpath for Java_JavabynataraJ_007
 Java installation done.

Set Classpath using Commnad Prompt:
Now Let us configure Classpath using Command prompt. Open Run(Win+R) type 'cmd' to open Command prompt.

Create a folder as jprogs under D:\ drive as

D:\cd jprogs

This folder contains your all java programs.

D:\jprogs> set path=%path%;C:\Program Files\Java\jdk1.6.0_26\bin

this tells us the system where to find JDK programs.

Use this command to compile java program:

D:\jprogs\javac HelloWorld.java

After compiling your programs using javac.exe you can see the class file among java file. Then run java file as

D:\jprogs\java HelloWorld

This runs the java interpreter. You should see the program output immediately.If the system cannot find find javac, check the classpath and set correctly. If javac runs but you are getting errors then check your java syntax or text.It may have some spelling mistakes or Capitalization mistakes. Be careful, Java is Case Sensitive.

Make your classpath permanent:
In Windows XP, go to Control Panel, choose "System," click on the "Advanced" tab, click on the "Environment variables" button. In the lower list, "System variables", click on Path:


Installing and Setting Classpath for Java_JavabynataraJ_008

Click "Edit" and append at the end

;C:\Program Files\Java\jdk1.5.0_09\bin

(or the path to the appropriate folder where the latest version of JDK is installed).  Do not put spaces before the appended path string.

Click OK on the path edit box and OK on the Ennvironment Variables box.  The new setting will go into effect next time you run Command Prompt.

 


0 comments:

Post a Comment