Introduction to Java

Java is an object-oriented programming  language which is platform independent.

 Java can be used to develop  many types of applications.
1) Desktop applications
2) Applets
3) Distributed applications
4) Mobile applications


1) Desktop applications: Its like a program that runs on desktop.

2) Applets: Applets is an small application which is executed on web-browser within JVM. Applets are like a java program which reside on server. Applets  can't be executed like a standalone application. To execute a Applet we need to embedding it into HTML page. when browser download such a HTML page it subsequently load executable file which have applet executed on local machine.

3) Web application: Web applications run on server. When we access a URL we are accessing a web application. The main components of web applications are.
1) Java servlets
2) Java server pages (JSP)
3) HTML

Java servlets are java programs, which runs on server and send the results to clients.
JSP can be combination of java and HTML.  web-server converts JSP into java servlets before execution.
when we assess  a URL if  it is in HTML it directly return the page but if it is in java servlets or JSP then it first execute on server and then return to client.

4) Distributed applications: Java applications can be divided  into components or modules which can be run on different systems and can communicate.

Java  source code  to executable:  The process is completed in two phases.
Java compiler: Java compiler compiles java source code and generates Byte code.  Which is machine independent.
Java Interpreter: Read Byte code and generates machine dependents code.

Java program file should have extension ".java"

Compile the java program : "javac text.java"
and it generats byte code file; "text.class"

Run  the java compiled file( .class file): "java text " .

Secure: java is more  secure because java program run within JVM.

security  related modules of java program:

a) Class loader
b) Byte code verifir
c) Security manager

 a) Class loader: loads  the class file from local machine or remote machine but a class loader from a remote machine can't loads the class file of local machine.

b) Byte code verifier : verify the byte code that it is a valid java code as soon as loader loads class file .
c) Security manager: checking security permissions.


Note: java have fix size primitive data type.

Java is pure object oriented but  support primitive data types.
Memory allocation in java is completely  dynamic.



February 3, 2015





















Comments

Popular posts from this blog

Creational Design Pattern: Factory Design Pattern

Design Patterns: The Secret Weapon of Expert Developers