Java2 platform
-
Upload
sajan-sahu -
Category
Technology
-
view
40 -
download
0
description
Transcript of Java2 platform
![Page 1: Java2 platform](https://reader036.fdocuments.in/reader036/viewer/2022062308/559aa0f21a28abf1088b4755/html5/thumbnails/1.jpg)
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
![Page 2: Java2 platform](https://reader036.fdocuments.in/reader036/viewer/2022062308/559aa0f21a28abf1088b4755/html5/thumbnails/2.jpg)
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
![Page 3: Java2 platform](https://reader036.fdocuments.in/reader036/viewer/2022062308/559aa0f21a28abf1088b4755/html5/thumbnails/3.jpg)
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.
![Page 4: Java2 platform](https://reader036.fdocuments.in/reader036/viewer/2022062308/559aa0f21a28abf1088b4755/html5/thumbnails/4.jpg)
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)
![Page 5: Java2 platform](https://reader036.fdocuments.in/reader036/viewer/2022062308/559aa0f21a28abf1088b4755/html5/thumbnails/5.jpg)
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.
![Page 6: Java2 platform](https://reader036.fdocuments.in/reader036/viewer/2022062308/559aa0f21a28abf1088b4755/html5/thumbnails/6.jpg)
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.
![Page 7: Java2 platform](https://reader036.fdocuments.in/reader036/viewer/2022062308/559aa0f21a28abf1088b4755/html5/thumbnails/7.jpg)
Migrating from C++ to Java
![Page 8: Java2 platform](https://reader036.fdocuments.in/reader036/viewer/2022062308/559aa0f21a28abf1088b4755/html5/thumbnails/8.jpg)
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.
![Page 9: Java2 platform](https://reader036.fdocuments.in/reader036/viewer/2022062308/559aa0f21a28abf1088b4755/html5/thumbnails/9.jpg)
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.
![Page 10: Java2 platform](https://reader036.fdocuments.in/reader036/viewer/2022062308/559aa0f21a28abf1088b4755/html5/thumbnails/10.jpg)
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.
![Page 11: Java2 platform](https://reader036.fdocuments.in/reader036/viewer/2022062308/559aa0f21a28abf1088b4755/html5/thumbnails/11.jpg)
The Java Buzz Words
Simple Secure Portable Object-oriented Robust Multithreading Architecture neutral Interpreted High performance Distributed Dynamic
![Page 12: Java2 platform](https://reader036.fdocuments.in/reader036/viewer/2022062308/559aa0f21a28abf1088b4755/html5/thumbnails/12.jpg)
Some important concepts of core Java
![Page 13: Java2 platform](https://reader036.fdocuments.in/reader036/viewer/2022062308/559aa0f21a28abf1088b4755/html5/thumbnails/13.jpg)
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
![Page 14: Java2 platform](https://reader036.fdocuments.in/reader036/viewer/2022062308/559aa0f21a28abf1088b4755/html5/thumbnails/14.jpg)
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.
![Page 15: Java2 platform](https://reader036.fdocuments.in/reader036/viewer/2022062308/559aa0f21a28abf1088b4755/html5/thumbnails/15.jpg)
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.*;
![Page 16: Java2 platform](https://reader036.fdocuments.in/reader036/viewer/2022062308/559aa0f21a28abf1088b4755/html5/thumbnails/16.jpg)
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.
![Page 17: Java2 platform](https://reader036.fdocuments.in/reader036/viewer/2022062308/559aa0f21a28abf1088b4755/html5/thumbnails/17.jpg)
Concept of Advanced JAVA
![Page 18: Java2 platform](https://reader036.fdocuments.in/reader036/viewer/2022062308/559aa0f21a28abf1088b4755/html5/thumbnails/18.jpg)
Advanced Java covers—
JDBCBEANSRMISERVLETSJSPEJB
![Page 19: Java2 platform](https://reader036.fdocuments.in/reader036/viewer/2022062308/559aa0f21a28abf1088b4755/html5/thumbnails/19.jpg)
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.
![Page 20: Java2 platform](https://reader036.fdocuments.in/reader036/viewer/2022062308/559aa0f21a28abf1088b4755/html5/thumbnails/20.jpg)
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.
![Page 21: Java2 platform](https://reader036.fdocuments.in/reader036/viewer/2022062308/559aa0f21a28abf1088b4755/html5/thumbnails/21.jpg)
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.
![Page 22: Java2 platform](https://reader036.fdocuments.in/reader036/viewer/2022062308/559aa0f21a28abf1088b4755/html5/thumbnails/22.jpg)
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
![Page 23: Java2 platform](https://reader036.fdocuments.in/reader036/viewer/2022062308/559aa0f21a28abf1088b4755/html5/thumbnails/23.jpg)
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.
![Page 24: Java2 platform](https://reader036.fdocuments.in/reader036/viewer/2022062308/559aa0f21a28abf1088b4755/html5/thumbnails/24.jpg)
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
![Page 25: Java2 platform](https://reader036.fdocuments.in/reader036/viewer/2022062308/559aa0f21a28abf1088b4755/html5/thumbnails/25.jpg)
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.
![Page 26: Java2 platform](https://reader036.fdocuments.in/reader036/viewer/2022062308/559aa0f21a28abf1088b4755/html5/thumbnails/26.jpg)
![Page 27: Java2 platform](https://reader036.fdocuments.in/reader036/viewer/2022062308/559aa0f21a28abf1088b4755/html5/thumbnails/27.jpg)