Introduction to Core Java - II

Why Java?

Java Programming language was mainly designed to develop internet applications by providing platform independency. Other programming languages like C, C++ supports developing only stand-alone applications, it can only be executed in current system and not by remote system by network call.

Who developed Java?

James Gosling, PhD along with other engineer scientists discovered Java at Sun Microsystems. He is famous software developer, best known as the father of the Java Programming Language.

Features of Java

Some of it's features are:

  1. Simple language :

    It eliminates all the difficulty and confusion oriented concepts like pointers, operator overloading etc.

    The C, C++ syntax is easy to understand, easy to remember and easy to write, Java maintains the C and C++ syntax mainly.

    Java takes less time to compile and execute the program.

  2. Object - Oriented Programming Language:

    Any Programming language which follows OOPs (Object Oriented Programming Principles) are termed as Object Oriented Programming Language and Java follows these principles.

    In Java, Data is objects and object reference is used to call all the methods and variables which is present in class.

  3. Platform Independent:

    Platform is software or hardware environment which is used to run programs.

    Compile java file on one Operating System and that compiled file can execute in any Operating System, that is Platform Independent Nature.

  4. Portable:

    Portability is the ability to run a program on different machines

  5. Robust:

    Any technology is said to be robust when it has features that make it reliable, resilient, and capable of handling errors and exceptions gracefully

    1. Exception Handling in Java

      Java is very good predefined exceptional handling mechanism, whenever we are getting exceptions we are having meaningful info.

    2. Memory Allocation

      Java has very good memory management system which dynamically allocates and deallocated memory at run-time.

  6. Secure:

    To provide implicit security, Java provides one component inside JVM called Security Manager

    To provide explicit security, Java applications have a very good predefined library in the form of java security package.

Multithreaded:

Threads enable concurrent execution of code, meaning multiple threads can run simultaneously. In java creation of such of types of threads are possible.

Types of applications

Based on the execution of the programs, all available applications are subdivided into two types:

  1. Stand-alone application :

    An application which can only be executed in local system with local call is called stand alone application.

Internet application :

An application which can be executed in local system with local call as well as in remote system with network call is called Internet application.

Types of Internet Application

We have two types of Internet Application -

  1. Web Supportive application:

    An application which resides in server system and that is downloaded and executed in client computer via network call is called as web supportive application.

  1. Web application:

    An application which resides in server system and that is executed directly in server system via network call and sending response(output) back to client is called web application.


Note :

  1. Every real world web project contains below three application:

    1. Web Supportive application

    2. Web Application

    3. Database interaction application

  1. In java we develop above application using:

    1. HTML/Applets (to develop web supportive application)

    2. Servlets and JSP (to develop web application)

    3. JDBC and EJB (to develop Database Interaction application)

  1. Web supportive application is used

    1. for collecting input from end-user by providing GUI then to pass it to web application

    2. for displaying output to end-user by providing Report

  2. Web application (Servlet and JSP technologies) is used for

    1. Processing request and

    2. Preparing response

      1. Servlet role is processing request -

        1. Reading input from network (which is sent by end user via HTML forms) then

        2. Executing Business logic by using this input then

        3. Finally generating output and sending it to JSP

      2. JSP role is preparing response -

        1. Generating dynamic HTML by using the output given by Servlet

        2. Sending the result HTML back to Servlet

      3. Then servlet sends this response to browser to display this output to end-user

  3. Database Interaction Application (JDBC/EJB) is used for performing CRUD operations on DB