You are on page 1of 29

Unit 1 WEB TECHNOLOGY

Lecture Topics to be covered


No.
Subject introduction
1 Introduction and web development strategies
2 history of web and internet
3 Protocols governing web
4 Writing web projects
5 Connecting to internet
6 Introduction to internet services and tools
7 Introduction to client-server computing
8 Core JAVA: introduction
7 Operator ,Variables ,Datatypes
9 Methods & Classes ,Inheritance
10 Exception handling
11 Multithread programming
12 I/O, JAVA Applets
13 String handling,Event handling
14 Introduction to AWT, AWT controls

Introduction and web development strategies

World Wide Web: The World Wide Web is a system of interlinked hypertext documents
accessed via the Internet. Web is a huge collection of pages of information linked to each other
around the globe.
Affectionately called “The Web”
It is a collection of information stored on the networked computers over the world.
Individual document pages on the World Wide Web are called web pages and are
accessed with a software application running on the user's computer, commonly
called a web browser.
Web pages may contain text, images, videos, and other multimedia components, as
well as web navigation features consisting of hyperlinks.
The WWW was proposed in 1991 by Tim Berners-Lee at CERN.
Web or Internet :Web or Internet, both are not the same things.
The Internet is a collection of computers or networking devices connecting together.
Devices can communicate with each other.
The Web is a collection of documents that are interconnected by hyper-links.
These documents are accessed by web browsers and provided by web servers.
Client :Any computer on the network that requests services from another computer on the
network.
Server : Any computer that receives requests from client computers, processes and sends
the output.
Web Page : Any page that is hosted on the Internet.
Web Site : Collection of interlinked web pages that is hosted on the Internet.
Web Development : the process of creating, modifying web pages.
Web Browser :A program that receives information from the web. E.g. IE, Chrome,
Mozilla etc.

How does the web work:

The web information is stored in the web pages. (In HTML Format)
The web pages are stored in the computers called web servers. (In the web server file
system.)
The computer reading the pages is called web clients with specific web browsers. ( IE,
Netscape, Mozilla, Chrome, Safari, Opera etc.)
The web server waits for the request from the web clients over the Internet.

History of Web and Internet:


History of internet:

The Internet grew out of many developments in computer networking and telecommunications
research.
Early projects undertaken in early 1960’s by the US military (known as DARPAnet).
Started with a dozen of Networked computer systems of universities and institutions, allowing
computers to be shared.
Allowing fast communication between researchers through Emails.
Only people in the government, military and academic had access to the network.
In 1991, the National Science Foundation (NFS) gradually started backing off from its subsidy of
the backbone network, then allowed commercial access to the internet. With commercial access
to the Internet, businesses and all kinds of agencies began to use the Internet to communicate,
exchange data and distribute information.
A host of businesses called Internet Service Providers (ISPs) sprang up. ISPs provide dialup
access to the Internet; an individual or a business opens an account with the ISP, dials into the
ISP's computer and via the ISP's computer connects to the Internet.
Internet traffic grew,
Many businesses spent heavily to improve the internet, therefore to better service their
customers.
Big competition among communication carriers, hardware and software suppliers.
As a result, Internet’s bandwidth climbed high, & cost went down

History of WWW:

WWW is created by Sir Tim Berners Leein 1989at CERNin Geneva.


In 1990, the first text only browserswere setup and CERNscientist
could access hypertext files and other information at CERN. HTML was based on a
subset of the standard generalized markup language (SGML). To transfer HTML
document to remote sites a new protocol was devised called HTTP (Hyper Text Transfer
Protocol).
In the fall of 1991, conference goes around the world started hearing about the promise
but sparks still were not flying.
In 1993, there are only about 50 websites world wide. A browser that allowed user to take
advantage of the web’s graphical capabilities was
developed at the National center for Super Computing application
(NCSA). NCSA called the browser Mosaic.
WWW allows computer users to locate and display multimedia-based documents.
Introduced in 1990 by Tim Berners-Lee of CERN (Geneva).
The portable browser is released by CERN as freeware in 1992.
In 1993, CERN produces Web server software with basic protection mechanism.
Tim Berners-Lee and Laboratory of Computer Science (LCS) of MIT start the W3C
Consortium in US. It is modeled after the X consortium.
Sun Microsystems in 1995, produces HotJava, a browser which incorporates interactive
objects.

Protocols Governing Web

Protocol: A protocol is a set of rules that is used to communicate applications to each other
Protocols are the set of conventions governing the processing and especially the data in an
electronic communication system.

The different protocols governing the web are:

HTTP (Hypertext Transfer Protocol)

Protocol used to access data on the WWW.


Uses one TCP connection on well known port -80.
Two types of HTTP messages: Request, Response
Used to transport HTML pages from web servers to web browsers.
Transfer data in the form of plain text, hypertext, audio, video, and so on.

2 TCP/IP (Transmission Control Protocol/ Internet Protocol)


TCP/IP is a set of protocols developed to allow cooperating computers to share resources
across a network.
They provide a few basic services that everyone needs (File transfer, electronic mail,
remote logon, etc…) across a very large number of clients and server systems. UDP
(User Datagram Protocol)

An unreliable connection less protocol used to control the management of application level
services between computers.

It is used for transport by some applications, which must provide their own reliability.

FTP (File Transfer Protocol)

It allows file transfer between two computers with login required.


FTP allows you to copy any kind of computer file (text, software, images, sounds, etc..)
from one computer to another via a network using the Internet. SMTP (Simple Mail
Transfer Protocol)
It is used to transport mail over Internet.
It is an application layer protocol, not a transport layer protocol. POP3 (Post Office
Protocol Version 3) • This protocol is used by clients to access an internet mail server to
get mail.
It is not a transport layer protocol.

IMAP4 (Internet Mail Access Protocol Version 4)

This protocol is used by clients to access an internet mail server to get mail.
It is not a transport layer protocol. TELNET
It is used to remotely open a session on another computer.
It relies on TCP for transport.

DHCP (Dynamic Host Configuration Protocol)

It is a method of assigning and controlling the IP addresses of computers on a given


network.
It is a server-based service that automatically assigns IP numbers when a computer boots.

Connecting of internet:
There are various type of connectivity to get hook on to Internet. They all can be broadly
classified into following category.
(i) Gateway Access
(ii) Dial-up Connection
(iii) Leased Connection
(iv) DSL
(v) Cable Modem Connection
(vi) VSAT
Gateway Access
Gateway Access is also known as Level-One connection. It is the access to the Internet
from a network, which is not on the Internet.
The gateway allows the two different types of networks to “talk” to each other. But the
users of the Gateway Internet have limited access to the Internet.
They might not be able to use all the tools available on Internet. The local Internet
Service Provider (ISP) normally defines this limitation.
Good example of network with Level One connectivity within India is that of VSNL
(Videsh Sanchar Nigam Limited).
All access to Internet from India are through VSNL gateway.

Dial-up Connection
‘Dial-up’ connection is also known as Level Two connection. This provides connection
to Internet through a dial-up terminal connection.
The computer, which provides Internet access is known as ‘Host’ and the computer that
receives the access, is ‘Client’ or ‘Terminal’.
The client computer uses modem to access a “host” and acts as if it is a terminal directly
connected to that host. 56K modem access is now widely available and supported by
most ISPs. It allows user to surf the Web at 56 Kbps with graphics. So this type of
connection is also known as ‘Remote Modem Access’ connection.
And the host to which the client gets connected is actually connected to the Internet by a
full time connection (See Leased Connection).
In dial-up connection to Internet, Host carries all the command that are typed on a client
machine and forward them to Internet.
It also receives the data or information from the Internet on behalf of the ‘Client’ and
passes it to them. The client computer acts as a ‘dumb’ terminal connected to remote
host.
This type of connection can further be divided into three categories.
Shell Connection:
In this type of Internet Connection, the user will get only textual matter of a Web Page.
This connection does not support Graphics display.
Shell Accounts were the only type of Internet access available for many years before the
Internet entered in to the world of graphics and became more users friendly.
TCP/IP Connection:

Today’s graphical World Wide Web browsers provide easier access with multimedia
sound and pictures.
The major difference between Shell and TCP/IP account is that, Shell account can only
display text and does not support graphics display, whereas TCP/IP can display both.
ISDN:

ISDN (Integrated Services Digital Network) offers Internet connectivity at speeds of up


to 128 Kbps through the use of digital phone lines.
ISDN is a dial-up service that has been provided by telephone companies for many years.
To access any of these dial-up accounts you need the followings;
• Computer
• Modem
• Telephone Connection
• Shell or TCP/IP/ISDN account from the ISP
• Internet client software such as Internet browser

Leased Connection
Leased connection is also known as direct Internet access or Level Three connection. It is
the secure, dedicated and most expensive, level of Internet connection.
With leased connection, your computer is dedicatedly and directly connected to the
Internet using high speed transmission lines. It is on-line twenty-four hours a day, seven
days a week.
DSL connection
Digital Subscriber Line (DSL) is a family of technologies that provides digital data
transmission over the wires of a local telephone network.
DSL originally stood for digital subscriber loop. In telecommunications marketing, the
term DSL is widely understood to mean Asymmetric Digital Subscriber Line (ADSL),
the most commonly installed DSL technology.
DSL service is delivered simultaneously with wired telephone service on the same
telephone line. This is possible because DSL uses higher frequency bands for data
separated by filtering.
On the customer premises, a DSL filter on each outlet removes the high frequency
interference, to enable simultaneous use of the telephone and data.
The data bit rate of consumer DSL services typically ranges from 256 kbit/s to 40 Mbit/s
in the direction to the customer (downstream), depending on DSL technology, line
conditions, and service-level implementation.
In ADSL, the data throughput in the upstream direction, (the direction to the service
provider) is lower, hence the designation of asymmetric service.
In Symmetric Digital Subscriber Line (SDSL) services, the downstream and upstream
data rates are equal.
Advantages:
• Security: Unlike cable modems, each subscriber can be configured so that it will not be on the
same network. In some cable modem networks, other computers on the cable modem network
are left visibly vulnerable and are easily susceptible to break in as well as data destruction.
• Integration: DSL will easily interface with ATM and WAN technology.
• High bandwidth
• Cheap line charges from the phone company.
• Good for “bursty” traffic patterns

Disadvantages
• No current standardization: A person moving from one area to another might find that their
DSL modem is just another paperweight. Customers may have to buy new equipment to simply
change ISPs.
• Expensive: Most customers are not willing to spend more than $20 to $25 per month for
Internet access. Current installation costs, including the modem, can be as high as $750. Prices
should come down within 1-3 years. As with all computer technology, being first usually means
an emptier wallet.
• Distance Dependence: The farther you live from the DSLAM (DSL Access Multiplexer), the
lower the data rate. The longest run lengths are 18,000 feet, or a little over 3 miles.

Cable Modem Connection

A cable modem is a type of Network Bridge and modem that provides bi-directional data
communication via radio frequency channels on a HFC and RFoG infrastructure.
Cable modems are primarily used to deliver broadband Internet access in the form of cable
Internet, taking advantage of the high bandwidth of a HFC and RFoG network.
They are commonly deployed in Australia, Europe, Asia and Americas.
Cable Modem Connection

Above figure shows the most common network connection topologies when using cable
modems. The cable TV company runs a coaxial cable into the building to deliver their Internet
service. Although fed from the same coax that provides cable TV service, most companies place
a splitter outside of the building and runs two cables in, rather than using a splitter at the set-top
box. The coax terminates at the cable modem.
The cable modem itself attaches to the SOHO computing equipment via its 10BASE-T port. In
most circumstances, the cable modem attaches directly to a user’s computer. If a LAN is present
on the premises (something many cable companies frown upon), some sort of router can be
connected to the cable modem.
Advantages
• Always Connected: A cable modem connection is always connected to the Internet. This is
advantageous because you do not have to wait for your computer to “log on” to the Internet;
however, this also has the disadvantage of making your computer more vulnerable to hackers.

Broadband: Cable modems transmit and receive data as digital packets, meaning they provide
high-speed Internet access. This makes cable modem connections much faster than traditional
dial-up connections.

• Bandwidth: Cable modems have the potential to receive data from their cable provider at
speeds greater than 30 megabits per second; unfortunately, this speed is rarely ever realized.
Cable lines are shared by all of the cable modem users in a given area; thus, the connection speed
varies depending upon the number of other people using the Internet and the amount of data they
are receiving or transmitting.
• File Transfer Capabilities: Downloads may be faster, but uploads are typically slower. Since
the same lines are used to transmit data to and from the modem, priority is often given to data
traveling in one direction.
• Signal Integrity: Cable Internet can be transmitted long distances with little signal degradation.
This means the quality of the Internet signal is not significantly decreased by the distance of the
modem from the cable provider.
• Routing: Cable routers allow multiple computers to be hooked up to one cable modem,
allowing several devices to be directly connected through a single modem. Wireless routers can
also be attached to your cable modem.

• Rely on Existing Connections: Cable modems connect directly to preinstalled cable lines. This
is advantageous because you do not need to have other services, such as telephone or Internet, in
order to receive Internet through your cable modem. The disadvantage is that you cannot have
cable internet in areas where there are no cable lines.

Disadvantages
• Cable internet technology excels at maintaining signal strength over distance. Once it is
delivered to a region, however, such as a neighborhood, it is split among that regions subscribers.
While increased capacity has diminished the effect somewhat, it is still possible that users will
see significantly lower speeds at peak times when more people are using the shared connection.

• Bandwidth equals money, so cable’s advantage in throughput comes with a price. Even in plans
of similar speeds compared with DSL, customers spend more per Mb with cable than they do
with DSL.

• It’s hard to imagine, but there are still pockets of the United States without adequate cable
television service. There are far fewer such pockets without residential land-line service meaning
cable internet is on balance less accessible in remote areas.

VSAT
Short for very small aperture terminal, an earthbound station used in satellite communications of
data, voice and video signals, excluding broadcast television. A VSAT consists of two parts, a
transceiver that is placed outdoors in direct line of sight to the satellite and a device that is placed
indoors to interface the transceiver with the end user’s communications device, such as a PC.
The transceiver receives or sends a signal to a satellite transponder in the sky. The satellite sends
and receives signals from a ground station computer that acts as a hub for the system. Each end
user is interconnected with the hub station via the satellite, forming a star topology. The hub
controls the entire operation of the network. For one end user to communicate with another, each
transmission has to first go to the hub station that then retransmits it via the satellite to the other
end user’s VSAT.
Advantages
Satellite communication systems have some advantages that can be exploited for the provision of
connectivity. These are:
• Costs Insensitive to Distance
• Single Platform service delivery (one-stop-shop)
• Flexibility
• Upgradeable
• Low incremental costs per unit

Disadvantages
However like all systems there are disadvantages also. Some of these are
• High start-up costs (hubs and basic elements must be in place before the services can be
provided)
• Higher than normal risk profiles
• Severe regulatory restrictions imposed by countries that prevent VSAT networks and solutions
from reaching critical mass and therefore profitability
• Some service quality limitations such the high signal delays (latency)
• Natural availability limits that cannot be mitigated against
• Lack of skills required in the developing world to design, install and maintain satellite
communication systems adequately.

Introduction to internet services and tools:

Internet Tools and Services The Internet covers large, international Wide Area Networks
(WAN‘s) as well as smaller Local Area Networks (LAN‘s) and individual computers connected
to the Internet worldwide.

The Internet supports communication and sharing of data, and offers vast amount of information
through a variety of services and tools.

The major Internet tools and services are:

• Electronic mail (email)


• Newsgroups

• Internet Relay Chat (IRC)

• Telnet and SSH

• File Transfer Protocol (FTP and FTPS, SFTP)

• World Wide Web (www)

Electronic mail , most commonly referred to as email or e-mail since ca. 1993, is a method of
exchanging digital messages from an author to one or more recipients E-mail clients allow you to
send and receive electronic mail messages.

To use e-mail on the Internet, you must first have access to the Internet and an e-mail
account set up (mostly free of charge) that provides you with an e-mail address.
Valid e-mail address consists of a username and a domain name separated by the @ sign.
An email message consists of three components: the message envelope, the message
header, and the message body.
The message header contains control information, including, minimally, an originator's
email address and one or more recipient addresses.
Usually descriptive information is also added, such as a subject header field and a
message submission date/time stamp.
Network-based email was initially exchanged on the ARPANET in extensions to the File
Transfer Protocol (FTP), but is now carried by the Simple Mail Transfer Protocol
(SMTP), first published as Internet standard 10 (RFC 821) in 1982.
In the process of transporting email messages between systems, SMTP communicates
delivery parameters using a message envelope separate from the message (header and
body) itself.

Newsgroups are often arranged into hierarchies, theoretically making it simpler to find related
groups. The term top-level hierarchy refers to the hierarchy defined by the prefix before the first
dot.

The most commonly known hierarchies are the Usenet hierarchies. Usenet is a news
exchange service similar to electronic bulletin boards.
Usenet is older than the Internet, but the two are commonly associated with one another
since most Usenet traffic travels over the Internet.
A Usenet newsgroup is a repository usually within the Usenet system, for messages
posted from many users in different locations. The term may be confusing to some,
because it is in fact a discussion group.
In recent years, this form of open discussion on the Internet has lost considerable ground
to browser-accessible forums and social networks such as Facebook or Twitter.
Introduction 6 Created by XMLmind XSL-FO Converter.

Internet Relay Chat (IRC) allows you to pass messages back and forth to other IRC users in
real time, as you would on a citizens' band (CB) radio.

It is mainly designed for group communication in discussion forums, called channels, but
also allows one-to-one communication via private message as well as chat and data
transfer.
IRC is an open protocol that uses TCP. An IRC server can connect to other IRC servers
to expand the IRC network. Users access IRC networks by connecting a client to a server.
The standard structure of a network of IRC servers is a tree. Messages are routed along
only necessary branches of the tree. Telnet allows you to log into another computer
system and use that system's resources just as if they were your own.

Telnet was developed in 1969 beginning with RFC 15, extended in RFC 854, and
standardized as Internet Engineering Task Force (IETF) Internet Standard STD 8, one of the
first Internet standards.

However, because of serious security issues when using Telnet over an open network
such as the Internet, its use for this purpose has waned significantly in favor of SSH
(Secure Shell). SSH uses public-key cryptography to authenticate the remote computer
and allow it to authenticate the user.

File Transfer Protocol (FTP) is a standard network protocol used to transfer files from one
host to another host over a TCP-based network, such as the Internet.

FTP is built on a client-server architecture and uses separate control and data connections
between the client and the server.
FTP users may authenticate themselves using a clear-text sign-in protocol, normally in
the form of a username and password, but can connect anonymously if the server is
configured to allow it.
For secure transmission that hides (encrypts) the username and password, and encrypts
the content, FTP is often secured with SSL/TLS ("FTPS"). SSH File Transfer Protocol
("SFTP") is sometimes also used instead, but is technologically different and based on the
SSH-2 protocol.

The World Wide Web, usually referred to simply as the Web, is a solution for displaying,
formatting and accessing multimedia information over a network such as the Internet.
It is a system of interlinked hypertext documents which allow related subjects to be
presented together without regard to the locations of the subject matter. Hyperlinks
function as pointers to information, whether the information is located within one website
or at any site throughout the world.
A website is a set of files residing on a computer (usually called a server or a host). Web
sites do not have to be connected to the Internet. Many organizations create internal Web
sites to enhance education, communications and collaboration within their own
organizations.
You access the site with software called a Web browser which displays the files as
"pages" on your screen.
The pages can contain files of text, graphics, sounds, animation, interactive forms-almost
any form of multimedia-and they can be downloaded to your computer.
WebPages are written in Hyper Text Markup Language (HTML). Recently, the Web has
become the predominant form of Internet communication (with the exception of e-mail),
far outstripping the use of other systems such as gophers, newsgroups or ftp sites.
It is already becoming a significant factor in many organizations' approaches to internal
and external communications and marketing.
The Web provides an immensely popular and accessible way to publish electronically,
offer services or simply express your creativity.
The Web hides all of the underlying technology from the user. When you access a
webpage, your browser locates and brings you the data. You do not have to worry about
where the information is located, and the browser manages all storage, retrieval and
navigation tasks automatically.
The Web can handle many forms of Internet communication, such as FTP, Gopher and
Newsgroups and Usenet, replacing the need for many other tools for using the Internet.
However, the story does not end in here.
The Web continuously changing and new technologies are emerging. The next biggest
invention is the Semantic Web which is currently just a little bit more than a vision.
The technologies are existing but the implementation is partial. It it became reality the
Web become one of the most important service of the Internet.

Internet Services

allows us to access huge amount of information such as text, graphics, sound and software
over the internet. Following diagram shows the four different categories of Internet Services
Communication Services

S.N. Service Description

1 Electronic Mail
Used to send electronic message over the internet.

2 Telnet
Used to log on to a remote computer that is attached to internet.

3 Newsgroup
Offers a forum for people to discuss topics of common interests.

4 Internet Relay Chat (IRC)


Allows the people from all over the world to communicate in real time.

5 Mailing Lists
Used to organize group of internet users to share common information through e-mail.

6 Internet Telephony (VoIP)


Allows the internet users to talk across internet to any PC equipped to receive the call.

7 Instant Messaging
Offers real time chat between individuals and group of people. Eg. Yahoo messenger, MSN
messenger.
There are various Communication Services available that offer exchange of information with
individuals or groups. The following table gives a brief introduction to these services:

Information Retrieval Services


There exist several Information retrieval services offering easy access to information present on
the internet. The following table gives a brief introduction to these services:
S.N. Service Description

1 File Transfer Protocol (FTP)


Enable the users to transfer files.

2 Archie
It’s updated database of public FTP sites and their content. It helps to search a file by its name.

3 Gopher
Used to search, retrieve, and display documents on remote sites.

4 Very Easy Rodent Oriented Netwide Index to Computer Achieved (VERONICA)


VERONICA is gopher based resource. It allows access to the information resource stored on
gopher’s servers.

Web Services
Web services allow exchange of information between applications on the web. Using web
services, applications can easily interact with each other.

The web services are offered using concept of Utility Computing.

World Wide Web (WWW)


WWW is also known as W3. It offers a way to access documents spread over the several servers
erov the internet. These documents may contain texts, graphics, audio, video, hyperlinks. The
hyperlinks allow the users to navigate between the documents

Introduction to Client-server computing

Logical extension of modular programming with assumption that separation of a huge


program into modules can create
The possibility for further modification
Easier development
Better maintainability.
All large modules need not all be executed within the same memory space.
The calling module becomes the client( requesting service)
The called module becomes the server (providing service).
Clients and Servers are running separately on appropriate hardware and software
platforms for their functions.
For example, database management system servers running on platforms specially
designed and configured to perform queries, or file servers running on platforms with
special elements for managing files.
Components in Client-Server Computing
Client
Server
Middleware

Basic Concepts Of Client-Server Computing the client-server model Server is of different


forms :

1. File server: The client passes requests for files or file records over a network to the file server.
This form of data service requires large bandwidth. Traditional LAN computing allows users to
share resources, such as data files and peripheral devices.

2. Database Server Client pass SQL requests as messages to the server and the results of the
query are returned over the network. Both the code that processes the SQL request and the data
reside on the server, allowing it to use its own processing power to find the requested data.

3. Transaction Server : Client invoke remote procedures that reside on servers, which also
contain an SQL database engine. The server has procedural statements to execute a group of
SQL statements. OLTP (On Line Transaction Processing) tend to be critical applications that
always require a 1-3 second response time and tight t control over the security and the integrity
of the database.

4. Application Server: Used to serve user needs. Downloading capabilities, e-mail process, allow
users to share data, while security and management services, also based on the server, ensure
data integrity and security.

Basic Characteristics: The basic characteristics of client server architectures as follows:

1. A combination of a client or front-end portion that interacts with the user and a server or back-
end portion that interacts with the shared resources.

2. The front-end task and back-end task have fundamentally different requirements for
computing resources.

3. The environment is typically heterogeneous and multivendor. The hardware platform and OS
of client and server are not usually the same. Client and Server processes communicate through a
well-defined set of standard application program interface (API).

4. Scalability.
Components: 1. User interface: Client server interacts with users, screens, windows, window
management ,keyboard and mouse handling.

2. Business processing: The application uses the user interface data to perform business tasks.

3. Database processing: The application code manipulates data with in the application. Data
manipulation is done using a data manipulation language such as SQL

Server - a computer program running to serve the requests of other programs, the “clients”
Servers are software programs that in most cases run off normal computing hardware. Server
software includes:

Printing File sharing Game hosting Websites Other web services

Client - an application or system that accesses a service made available by a server Clients are
software programs and processes that connect to servers, sending requests and receiving
responses. Client examples include:

Web browser page requests


Chat systems on mobile phones
Online games

CORE JAVA

INTRODUCTION:

What is Java ?
Java is a platform-independent programming language used to create secure and robust
application that may run on a single computer or may be distributed among servers and clients
over a network.
Java features such as platform-independency and portability ensure that while developing Java
EE enterprise applications, you do not face the problems related to hardware , network , and the
operating system.

History of Java ?
Java was started as a project called "Oak" by James Gosling in June 1991. Gosling's goals were
to implement a virtual machine and a language that had a familiar C like notation but with
greater uniformity and simplicity than C/C++.
The First publication of Java 1.0 was released by Sun Microsystems in 1995. It made the promise
of "Write Once, Run Anywhere", with free runtimes on popular platforms.
In 2006-2007 Sun released java as open source and and plateform independent software.
Over time new enhanced versions of Java have been released. The current version of Java is Java
1.7 which is also known as Java 7.

What is JVM (Java Virtual Machine) & JRE( Java Run time Environment)?
The Java virtual machine (JVM) is a software implementation of a computer that executes
programs like a real machine.
The Java virtual machine is written specifically for a specific operating system, e.g. for Linux a
special implementation is required as well as for Windows.
Java programs are compiled by the Java compiler into bytecode. The Java virtual machine
interprets this bytecode and executes the Java program.
The Java runtime environment (JRE) consists of the JVM and the Java class libraries and
contains the necessary functionality to start Java programs.
The JDK contains in addition the development tools necessary to create Java programs. The JDK
consists therefore of a Java compiler, the Java virtual machine, and the Java class libraries.

Features of Java
The prime reason behind creation of Java was to bring portability and security feature into a
computer language. Beside these two major features, there were many other features that played
an important role in moulding out the final form of this outstanding language. Those features are
1) Simple

Java is easy to learn and its syntax is quite simple, clean and easy to understand.The confusing
and ambiguous concepts of C++ are either left out in Java or they have been re-implemented in a
cleaner way.
Eg : Pointers and Operator Overloading are not there in java but were an important part of C++.
2) Object Oriented
In java everything is Object which has some data and behaviour. Java can be easily extended as
it is based on Object Model.
3) Robust
Java makes an effort to eliminate error prone codes by emphasizing mainly on compile time
error checking and runtime checking. But the main areas which Java improved were Memory
Management and mishandled Exceptions by introducing automatic Garbage Collector and
Exception Handling.
4) Platform Independent
Unlike other programming languages such as C, C++ etc which are compiled into platform
specific machines. Java is guaranteed to be write-once, run-anywhere language.
On compilation Java program is compiled into bytecode. This bytecode is platform independent
and can be run on any machine, plus this bytecode format also provide security. Any machine
with Java Runtime Environment can run Java Programs.

5) Secure
When it comes to security, Java is always the first choice. With java secure features it enable us
to develop virus free, temper free system. Java program always runs in Java runtime environment
with almost null interaction with system OS, hence it is more secure.
6) Multi Threading
Java multithreading feature makes it possible to write program that can do many tasks
simultaneously. Benefit of multithreading is that it utilizes same memory and other resources to
execute multiple threads at the same time, like While typing, grammatical errors are checked
along.
7) Architectural Neutral
Compiler generates bytecodes, which have nothing to do with a particular computer architecture,
hence a Java program is easy to intrepret on any machine.
8) Portable
Java Byte code can be carried to any platform. No implementation dependent features.
Everything related to storage is predefined, example: size of primitive data types
9) High Performance
Java is an interpreted language, so it will never be as fast as a compiled language like C or C++.
But, Java enables high performance with the use of just-in-time compiler.
10) Dynamic

Because it is interpreted , Java is an extremely dynamic language, At runtime, the java


environment can extends itself by linking in classes that may be located on remote servers on a
network(for example, the internet)

At runtime, the java interpreter performs name resolution while linking in the necessary classes.
The Java interpreter is also responsible for determining the placement of object in memory.
These two features of the Java interpreter solve the problem of changing the definition of a class
used by other classes.
11) Interpreted

We all know that Java is an interpreted language as well. With an interpreted language such as
Java, programs run directly from the source code.

The interpreter program reads the source code and translates it on the fly into computations.
Thus, Java as an interpreted language depends on an interpreter program.

The versatility of being platform independent makes Java to outshine from other languages. The
source code to be written and distributed is platform independent.

Another advantage of Java as an interpreted language is its error debugging quality. Due to this
any error occurring in the program gets traced. This is how it is different to work with Java.

12) Distributed.

Java facilitates the building of distributed application by a collection of classes for use in
networked applications. By using java?s URL (Uniform Resource Locator) class, an application
can easily access a remote server. Classes also are provided for establishing socket-level
connections.

What is Object Oriented Programming?

Object Oriented Programming is a programming paradigm that uses "objects" to design


applications and computer programs. It utilizes several techniques from previously
established paradigms, including inheritance, modularity, polymorphism, and
encapsulation.

A software design method that models the characteristics of real or abstract objects using
software classes and objects.

Characteristics of “Object”:

State(what the object have), Behavior(what the objects do), Identity(what makes them
unique)

For example, a car is an object.

Its states includes: Speed, RPM, Gear, Direction, Fuel level.

Its behavior includes: Change Gear, Go faster/slower, Go in reverse, stop.

Its identity includes: Number plate.

Object and Class in Java


In object-oriented programming technique, we design a program using objects and classes.
Object is the physical as well as logical entity whereas class is the logical entity only.

Object in Java

An entity that has state and behavior is known as an object e.g. chair, bike, marker, pen, table,
car etc. It can be physical or logical (tangible and intangible). The example of intangible object is
banking system.

An object has three characteristics:

● state: represents data (value) of an object.


● behavior: represents the behavior (functionality) of an object such as deposit, withdraw
etc.
● identity: Object identity is typically implemented via a unique ID. The value of the ID is
not visible to the external user. But, it is used internally by the JVM to identify each
object uniquely.

For Example: Pen is an object. Its name is Reynolds, color is white etc. known as its state. It is
used to write, so writing is its behavior.

Object is an instance of a class. Class is a template or blueprint from which objects are created.
So object is the instance(result) of a class.

Object Definitions:

● Object is a real world entity.


● Object is a run time entity.
● Object is an entity which has state and behavior.
● Object is an instance of a class.

Class in Java

● A class is a group of objects which have common properties. It is a template or blueprint


from which objects are created. It is a logical entity. It can't be physical. A class is a
template or blueprint that is used to create objects.
● Class representation of objects and the sets of operations that can be applied to such
objects.
● Class consists of Data members and methods.
Primary purpose of a class is to held data/information. This is achieved with attributes which is
also known as data members.

The member functions determine the behavior of the class i.e. provide
definition for supporting various operations on data held in form of an
object.

A class in Java can contain:

● fields
● methods
● constructors
● blocks
● nested class and interface

Syntax to declare a class:

1. class <class_name>{
2. field;
3. method;
4. }

Variables in JAVA:

What is a variable?

When we want to store any information, we store it in an address of the computer. Instead
of remembering the complex address where we have stored our information, we name
that address.The naming of an address is known as variable. Variable is the name of
memory location.

Java Programming language defines mainly three kind of variables.

1. Instance variables
2. Static Variables
3. Local Variables

Local variables − Variables defined inside methods, constructors or blocks are called local
variables. The variable will be declared and initialized within the method and the variable will be
destroyed when the method has completed.
Ex:
float getDiscount(int price)
{
float discount;
discount=price*(20/100);
return discount;
}
Here discount is a local variable.
Instance variables − Instance variables are variables within a class but outside any method.
These variables are initialized when the class is instantiated. Instance variables can be accessed
from inside any method, constructor or blocks of that particular class.
Ex:

class Student
{
String name;
int age;
}
Here name and age are instance variable of Student class.
Static/Class variables − Class variables are variables declared within a class, outside any
method, with the static keyword.

static variable are also known as class variable.


static means to remain constant.
In Java, it means that it will be constant for all the instances created for that class.
static variable need not be called from object.
It is called by classname.static variable name

Ex:
class Student
{
String name;
int age;
static int instituteCode=1101;
}
Here instituteCode is a static variable. Each object of Student class will share
instituteCode property.

Operators in java:

java provides a rich set of operators to manipulate variables. We can divide all the Java operators
into the following groups:

● Arithmetic Operators
● Relational Operators
● Bitwise Operators
● Logical Operators
● Assignment Operators

Arithmetic Operators

Arithmetic operators are used in mathematical like addition, subtraction etc. The following table
lists the arithmetic operators:

Assume that int X = 10 and int Y = 20

Operators Description

+ Addition – Adds values on either side of the operator

- Subtraction – Subtracts right hand operand from left hand operand

* Multiplication – Multiplies values on either side of the operand

/ Division - Divides left hand operand by right hand operand

Modulus - Divides left hand operand by right hand operand and


%
returns remainder

++ Increment - Increase the value of operand by 1

-- Decrement - Decrease the value of operand by 1

Example:

public class Main{


public static void main(String args[]{
Int X = 10;
Int Y = 20;
System.out.println("Addition (X+Y) = "+(X+Y)); // return 30
System.out.println("Subtraction (X-Y) = "+(X-Y)); // return -
10
System.out.println("Multiplication (X*Y) = "+(X*Y)); // return
200
System.out.println("Division (Y/X) = "+(Y/X)); // return 2
System.out.println("Addition (Y%X) = "+(Y%X)); // return 0
Y++;
System.out.println("Increment Y = "+Y); // return 21
X--;
System.out.println("Decrement X = "+X); // return 9
}
}

Relational Operators
There are following relational operators supported by Java language like ==, ! = etc.

Assume variable X=10 and variable Y=20 then:

Operator Description

Checks if the value of two operands are equal or not, if yes then condition
==
becomes true.

Checks if the value of two operands are equal or not, if values are not equal
!=
then condition becomes true.

Checks if the value of left operand is greater than the value of right operand,
>
if yes then condition becomes true.

Checks if the value of left operand is less than the value of right operand, if
<
yes then condition becomes true.

Checks if the value of left operand is greater than or equal to the value of
>=
right operand, if yes then condition becomes true.

Checks if the value of left operand is less than or equal to the value of right
<=
operand, if yes then condition becomes true.

Example :

public class Main{


public static void main(String args[]){
int X = 10;
int Y = 20;
System.out.println("(X == Y) = "+(X == Y));
System.out.println("(X != Y) = "+(X != Y));
System.out.println("(X > Y) = "+(X > Y));
System.out.println("(X < Y) = "+(X < Y));
System.out.println("(X >= Y) = "+(X >= Y));
System.out.println("(X <= Y) = "+(X <= Y));
}
}

Bitwise Operators

Java defines several bitwise operators like &, | etc which can be applied to the integer types(long,
int, short, char, and byte).
Bitwise operator works on bits(0 or 1) and perform bit by bit operation. Assume if x = 60; and y
= 13; Now in binary format they will be as follows:

x = 0011 1100

y = 0000 1101

-----------------

x&y = 0000 1100

x|y = 0011 1101

x^y = 0011 0001

~x = 1100 0011

The following table lists the bitwise operators:

Assume integer variable X=60 and variable Y=13 then:

Operator Description

& Binary AND Operator copies a bit to the result if it exists in both operands.

| Binary OR Operator copies a bit if it exists in eather operand.

^ Binary XOR Operator copies the bit if it is set in one operand but not both.

~ Binary Ones Complement Operator is unary and has the effect of 'flipping' bits.

Binary Left Shift Operator. The left operands value is moved left by the
<<
number of bits specified by the right operand.

Binary Right Shift Operator. The left operands value is moved right by the
>>
number of bits specified by the right operand.

Shift right zero fill operator. The left operands value is moved right by the
>>> number of bits specified by the right operand and shifted values are filled up
with zeros.
Example :

public class Main{


public static void main(String args[]){
int X = 60;
int Y = 13;
System.out.println("(X & Y) = "+(X & Y));
System.out.println("(X | Y) = "+(X | Y));
System.out.println("(X ^ Y) = "+(X ^ Y));
System.out.println("(~X) = "+(~X));
System.out.println("(X << Y) = "+(X << 2));
System.out.println("(X >> Y) = "+(X >> 3));
System.out.println("(X >>> Y) = "+(X >>> 1));
}
}

Logical Operators

The following table lists the logical operators like &&, || etc. This logical operator use for join
two condition.

Assume boolean variables X=true and variable Y=false then:

Operator Description

Called Logical AND operator. If both the operands are non zero then then
&&
condition becomes true.

Called Logical OR Operator. If any of the two operands are non zero then then
||
condition becomes true.

Called Logical NOT Operator. Use to reverses the logical state of its operand.
!
If a condition is true then Logical NOT operator will make false.

Example:

public class Main{


public static void main(String args[]){
int X = 60;
int Y = 13;
if((X == Y) && (X != Y)){
System.out.println("True");
}else{
System.out.println("False");
}
if((X == Y) || (X != Y)){
System.out.println("True");
}
else{
System.out.println("False");
}
}
}

Assignment Operators

There are following assignment operators supported by Java language:

Operator Description

Simple assignment operator, Assigns values from right side operands to left
=
side operand

Add AND assignment operator, It adds right operand to the left operand and
+=
assign the result to left operand

Subtract AND assignment operator, It subtracts right operand from the left
-=
operand and assign the result to left operand

Multiply AND assignment operator, It multiplies right operand with the left
*=
operand and assign the result to left operand

Divide AND assignment operator, It divides left operand with the right
/=
operand and assign the result to left operand

Modulus AND assignment operator, It takes modulus using two operands and
%=
assign the result to left operand

<<= Left shift AND assignment operator

>>= Right shift AND assignment operator

&= Bitwise AND assignment operator

^= Bitwise exclusive OR and assignment operator

|= Bitwise inclusive OR and assignment operator

Example:
public class Main{
public static void main(String args[]){
int X = 60;
int Y = 13;
X += 1;
System.out.println("X+=1 : "+X);
Y<<=1;
System.out.println("Y<<=1 : "+Y);
/* Return 26 : 13(binary - 00001101) shift one bit left means
26(00011010) */
}
}

You might also like