java2 platform
DESCRIPTION
java2TRANSCRIPT
A seminar on Advanced Programming in
Java2 platform
Prepared by:Saroj Kumar SahuRoll no: 089Regd. No: 0505247092MCA 2nd semester
Guided by: Mr. S.K. MohapatraLecturer MCA
Contents
Creation of Java Importance of java to internet Migration from c++ to java What java has removed from c++
New features added by Java Basics of core Java Basics of Advance Java
Creation of JAVA
Conceived by James Gosling Patric Naughton Chris Worth Ed Frank Mike Sheridon
At Sun Microsystems Inc in 1991. It took 18 months to develop the first working version. This was initially called as “Oak” and renamed as “Java” in 1995.
The original impetus was not the Internet, instead the primary motivation factor was platform independent (architecture neutral).
The java platform differs from other platforms in that it is a software only platform, that runs on the top of the h/w-based platforms.
The java platform has two components:
Java Virtual Machine(JVM)
Java Application Programming Interface(Java API)
Why Java is Important to the Internet
Java has had a profound effect on the internet. Reason is Java expands the universe of objects that can move about freely in cyber space. In a network two very broad categories of objects are transmitted between the server and your PC:
Passive information.Dynamic or Active programs.
Java’s Magic : the Byte Code
Byte code is highly optimised set of instructions designed to be executed by the java run time system(JVM).
JVM is an interpreter for Byte code.
When a java program is translated into Byte code it is easier to execute that program in a wide variety of computers.
Migrating from C++ to Java
What Java has removed from C++
Perhaps the most biggest difference between Java & C++ is that Java doesn’t support pointers. It doesn’t exist in Java for this reason:-
Pointers are inherently insecure.
Few more of the most important omissions
Java doesn’t include structure & unions. Java doesn’t support operator overloading. Doesn’t include preprocessor nor does it support
preprocessor directive. Doesn’t support automatic type conversion that result in
loss of precision. Doesn’t allow default arguments. Although Java support constructors, it doesn’t have
destructors, it does however add finalize() function. Java doesn’t support typedef. It doesn’t allow goto & doesn’t have delete operator.
New features added by Java Multithreading: allows two or more pieces of the same
program to execute concurrently.
There is no feature in C++ that directly corresponds to a Java package. The closest similarity is a set of library functions that use a common header file.
The Java interface is somewhat similar to C++ abstract class.
Java removes the C++ standard library replacing it with its own set of API classes.
The Java Buzz Words
Simple Secure Portable Object-oriented Robust Multithreading Architecture neutral Interpreted High performance Distributed Dynamic
Some important concepts of core Java
Fundamentals of Packages
Java packages are the ways of grouping a variety of classes and interfaces together. So that packages act as container of classes.
packages are of two types: API packages User defined packages
API
Java.awtJava.lang Java.util Java.net Java.io Java.applet
Java.lang: these classes automatically imported and include classes for primitive data types, strings, math functions.
Java.util: contains language utility classes such as vectors, dates, random numbers.
Java.awt: set of classes for implementing Graphical User Interface.
Java.net: include classes for communicating with local computers as well as internet servers.
Java.io: this package contains classes for input and output of data.
Java.applet: this package include classes for creating and implementing applets.
Applet Fundamentals
Applets are small applications that are accessed on an
internet server, transported over the internet, automatically
installed and runs as part of a web document.
This applet begins with two important statements-
import java.awt.*;
import java.applet.*;
An Applet skeletonAn applet is a program that doesn’t contain the main()
method and contain the followings as basic structure. init() start() paint() stop() destroy()An applet generally run by a web browser and carries out its input/output by using Graphical User Interface supported byawt.Each applet class is to be a subset of predefined Applet class.
Concept of Advanced JAVA
Advanced Java covers—
JDBCBEANSRMISERVLETSJSPEJB
JDBC Getting Started
JDBC API –
Part of JDK.
Enable Java Application to connect with a database.
Contain set of classes and interfaces that are used to connect
to a database.
Is a low level interface.
Can be used with both 2-tier and 3-tier architecture.
Servlets These are required to
Reduce the overhead on the server and network. To take care of processing data on web server.
Servlets are Java programs that can be deployed on a java enabled web
server. Used for dynamic connect to web page.
Characteristics Efficient: Initialization code for a servlet is executed only once. Robust: Provide all powerful features of java portable across web
servers. Persistent: Increase the performance of a system by preventing
frequent data access.
Comparison between servlet and applet
Applets: Embedded in web pages. Requires the browser to be java enabled. Take a lot of time to download.
Servlets: Don’t require the browser to be java enabled. Execute on the webserver, thus helps to overcome
problems with download time.
RMI It is a specification that enables one java virtual machine
to invoke methods in an object located in another JVM. Is implemented on the middle tier of the 3-T architecture. Facilitates the programmer to invoke distributed
components across a network environment. Is an easy alternative to the complex server-socket
program. Programmers can solely concentrate in developing
business logic.
Main component RMI server RMI client
RMI server Contain the objects whose methods are to be invoked
remotely. Creates several remote object and makes a reference of
these objects in the RMI registry. RMI registry registers objects that are to be remotely
invoked by the client.
RMI client Get the reference of one or more remote objects from RMI
registry by looking up the object name.
Invoking the methods on the remote objects to access the
services of the remote objects.
JSP JSP is an extended servlet. Powerful technology to generate dynamic html on the web
or server side. It allow the developer & designer to jointly work
simultaneously and to give a dynamic output to a client. This technology also allows the segregation of static and
dynamic content. After the compilation of JSP it automatically converted to
servlet. Any changes made to the JSP (either by decoder or
designer) are automatically recompiled and reloaded during consecutive request.
First time JSP server is very slower because it generates the server
Beans A java bean is a s/w component that has been designed to be
reusable in a variety of different environments. There is no restriction on the capacity of bean. It may perform a simple function, checking the spelling of a document, or a complex function such as forecasting the performance of a stock portfolio.
Advantages A bean obtains all the benefits of java’s “write-once, run-anywhere”
paradigm. A bean may register to receive events from other objects and can
generate events that are sent to other objects.