online chatting

34
ACKNOWLEDGMENT The satisfaction and euphoria that accompany the successful completion of my project would be incomplete without the people who made it possible for me, whose constant guidance and encouragement crowned my efforts with success. I consider its my privilege to express my gratitude and respect to all those who guided and inspired me in the completion of my project. Mr. Ram Babu (Manager- Software Operations) was with us at every stage of the implementation and found time for as in his busy schedule. He gave ideas when we did know how to proceed and his help proved invaluble during troubleshooting. Our heartfelt thanks to him. . I express my sincere gratitude to Mr. Praveen Goud, Java Teacher,, NIT, Ameerpet, Hyderabad who gave timely suggestions and help in all respects. Name of the Student

Transcript of online chatting

Page 1: online chatting

ACKNOWLEDGMENT

The satisfaction and euphoria that accompany the successful completion of my

project would be incomplete without the people who made it possible for me,

whose constant guidance and encouragement crowned my efforts with success.

I consider its my privilege to express my gratitude and respect to all those who

guided and inspired me in the completion of my project. Mr. Ram Babu

(Manager- Software Operations) was with us at every stage of the

implementation and found time for as in his busy schedule. He gave ideas

when we did know how to proceed and his help proved invaluble during

troubleshooting. Our heartfelt thanks to him. .

I express my sincere gratitude to Mr. Praveen Goud, Java Teacher,, NIT,

Ameerpet, Hyderabad who gave timely suggestions and help in all respects.

Name of the Student

Page 2: online chatting

ABSTRACT

PROJECT TITLE: INTRANET CHATTING SYSTEM

PROJECT DESCRIPTION:

The aim of the project is to provide a way of efficient communication

among the users (Clients) located on different places within an

Organization using Distributed Computing (Intranet). Any two users can

communicate to each other using the front en given to them. The user just

start the client program and registers him self with the server to start the

communication.

The project contains distributed multithreaded server program, which

receives the requests from the clients for the following:

1. The client registers himself with server for chatting.

2. The client sends the message to any other clients.

3. The client unregisters himself from the chatting.

The server program should take care of all these activities carefully. In the

first activity the server should store all the user names and client

references in a hash table and the server uses this Hash table for sending

the messages to clients, registering and unregistering the user names.

When any new clients joins the chat group the information should be

Immediately shown in the choice boxes of al the clients as all as in their

text areas.

Page 3: online chatting

In the second activity the server should invoke the respective method to

find the target client from the hash table and should sent the message to

the target exactly.

When any client unregisters from the chat group this should be conveyed

to al the remaining clients present.

The server program should run continuously which keeps track of al the

clients

The client is provided as an applet with the following front end.

There may be number of clients started simultaneously and can chat

to each other through the server.

NOTE:

1. This project can be done using any one of the following Distributed

Technology such as (RMI/CORBA)

2. Use proper validations wherever necessary.

3. It is recommended to use the light eight sing components to create the

front end.

Page 4: online chatting

CONCLUSION

A computerized model for chatting with the various users at a time. This System

helps the User to log into the application whenever he desires and can select to

whom he want’s to chat within the network.

The application is very flexible and user friendly. There is no need to monitor

while a person is chatting.

The application is developed in Java and all the features of Java are used in it. It

can be made global through Internet thus enabling the person even in the remotest

part of the world in assessing his knowledge.

Page 5: online chatting

INTERNET & INTRANET TECHNOLOGY

World Wide Web:

A WWW is global hypertext system that uses the Internet system as its

transmission medium. It contains all the hypertext media, which are connected

by links all these are wrapped up in a web. A collection of documents inter

linked by hyperlinks is called a web.

Internet:

An Internet is a network of closely connected computers all over the world

where each computer acts a web site.

Intranet:

An Intranet is a network of connected computers with in a domain.

Website:

A Web site is a computer system that runs a web server and has been for

publishing documents. Some of the computers which act as the store house of

information is called a web site. It is a collection of web pages connected

together with hyperlinks so that each is associated with the others. Some web

site may have a single document while consist of hundred of pages.

Homepages:

A home page is a document that serves as an initial point of entry to web site

of related documents. It contains introductory information, hyperlinks to

I.exe

Page 6: online chatting

resources and navigation buttons to help users find their way among the

various documents.

Webpages:

The web pages are just the test-encoding of what the application intends to

present to the users. Every web site has get a unique address called Uniform

Resource Location (URL) or the Internet Protocol (IP) address. The URL is an

address that the web uses to find the specific information on the Internet. The

URL can locate something which is local to the system or anywhere remote on

the Internet. An example of web site address could be

HTTP://WWW.SUNSOFT.COM where http:// represents the protocol path and

www.sunsoft.com represents the domain organization. Similarly we do have

.GOV for government, .EDU for educational institutions etc.

Web Server:

A web server is a program that accepts the requests for information framed

according to HTTP. The server processes the requests and sends back the

requested documents.

Hyper Text Transfer Protocol (HTTP) :

HTTP is a protocol that moves the html documents over the Internet.

Page 7: online chatting

Software Requirement and analysis:

Java has been identified as most popular and user friendly software available to

the programming world.It has lot of potential in programming deep in to system.

When Java combined with some of the system internals it can become very

powerful comparing with other system related software. Based on these analysis

we chose to use java as our programming Front end.As we know, Java makes the

software platform independent and supports Object Oriented Concepts.

What is Java?

Java is a quite new object oriented programming language. It is developed by Sun

Microsystems and was first initiated in January 1991. The Java compiler, written

in Java, was introduced to the public in May 1995 and Netscape announces that

they plan to support the new language in their browsers. In December the same

year, it is clear that both Oracle and Microsoft will support Java in their products.

From that day, Java's market share has only been increasing and the language has

become popular by programmers all over the world.

Why did we use Java?

Because of the cross platform, open source nature of the project, it was also

important to choose a widely available language that ran on multiple platforms.

Java also has a clear syntax and strict naming and casting rules which is great

when being multiple developers on the same project. Also, the settled conventions

in java (thank you Sun) helps keeping the java code so clear and clean.

We also considered using Python as an additional language to Java. Python is well

known for it's powerful string manipulation functions, which Java lacks. Due to

Page 8: online chatting

loss in performance when executing Python from within Java, and based on advice

from several Python/Java coders, we choose not to use Python. Some string

manipulation functions where instead written by ourselves, found in

GartHandyMan.

Class names

All class names starts with "Gart", indicating that the class is part of the gart

package. Interfaces starts with a "i" for "interface". After the first, capitalised

letter, the classes also "starts" with a capitalised letter.

Methods

All methods start with small letters, as in the Java code convention, and the

arguments are given as lower case letters, that are abbrevations of the object type.

All words in the method name are captilised, except the first one, as stated above.

E.g. "setNewComponent( String arr[ ][ ] )".

Whitespace and braces

All parantheses are entered with a space at the beginning and at the end, e.g. ( an

example ). Blocks are indented 3 spaces, and tabs are of course replaced with

spaces (3 spaces). Start and end braces are written on the next line under the first

letter of the statement or method/class decleration.

Page 9: online chatting

Java Development Kit

We have used Sun's Java Development Kit version 1.3 (JDK) as Java

compiler, virtual machine and JavaDoc generator. All theese tools er

familiar, an we had little problem using them.

System Design:

Intranet Chatting software tool has been designed keeping in view of all the

technical aspects, to suit the proposed requirements using the current

technology.Network communication software does not include any external

memory hungry .dll or .exe files. It even doesn’t adapt any third party controls. It

exploits the Usage Of sockets of the system.

The intranet chatting software has been modularized into following modules…

a) User Creation

b) Login Process

c) Chat server process

d)Messages

Page 10: online chatting

Module Description:a) User Creation:

The User must be registered with the System to use The Intranet chatting software

connected within a net work. For User Registration he will get a Registration

screen .The user should fill necessary data with the Registration applet and the

data can be stored within a Database.

b) Login process:

The Registered user can interact with the system.

When ever the user login to the system, his username and password can be

verified from the database ,if the user is valid can get the options includes Modify

and chat.

Choosing modify he can change his password and the database can be updated. By

choosing chat he can get connected to the chatserver; so that he liable to chat with

the intranet connected users

Page 11: online chatting

INTRODUCTION TO INTRANETS

The Intranet is a by-product of the Internet, or specifically that part of Internet called as the

World Wide Web or WWW. The Internet is called as the mother of all networks, and rightly

so, because thousands of computers network, with millions of hosts is connected to the

Internet. The Internet is a huge reservoir of information, information that has been supplied

by companies, professionals and individuals. Most of this information can be accessed for

free. The global nature of the Internet is ideal for business as it gives the customer the best in

terms of price and quality. The WWW binds together various documents with links using a

scripting language called as HyperText Markup Language or HTML. The development of

the web browser has boosted the usage of the Internet to unprecedented levels.

Gradually, thoughts turned to using this technology in offices and college campuses. Thus

was born the concept of Intranet. Since the Internet used TCP/IP, as it’s standard protocol,

TCP/IP became the primary protocol of the Intranet. But this was a problem since a majority

of the companies were using Novell NetWare’s IPX protocol or Microsoft’s NETBEUI

protocol on their local area networks. This problem was solved with the development of

software that allowed machines running IPX or NETBEUI to communicate using TCP/IP

also. Now the same tools required for developing and user Internet-based applications could

be used to develop and use Intranet-based applications. One of the biggest advantages of the

Internet has been a standardization of protocols.

Even though the Internet and Intranet is practically the same thing, the former being only

larger, there are some subtle differences between the two.

Page 12: online chatting

The following table lists these points of differentiation -

Differences between Internet and Intranet

INTERNET INTRANET

BANDWIDTH 28.8 Kbps dialup64/128 Kbps leased

lines1.5 Mbps T1 lines

10 Mbps for Ethernet

SECURITY Insecure Secure–dependingon administrator

ACCESSIBILITYPublic viewing Private viewing

An Intranet does not only mean an in-house Website. It incorporates many other

technologies like electronic mail, printing services and file services. Electronic mail or e-

mail as it is popularly known as, is the service that has the largest impact on the Intranet. In

the past, e-mail on LAN meant using proprietary products from various vendors. These

products did not interact with products from other vendors. But with the advent of the

Internet a single mail protocol, the Simple Mail Transport Protocol or SMTP, became a

worldwide standard. Hence mail software made by different vendors could now interact with

each other because they all supported SMTP. Setting up an in-house e-mail server on the

Intranet involves setting up of the mail server software and configuring the e-mail clients on

the user’s machines to contact the mail server.

Today’s intranets are gradually evolving to provide services that have traditionally been the

domain of proprietary network operating systems such as Novell NetWare and Windows

NT, such as file services, print services, directory and network management. These Intranets

are becoming known as Full service Intranets.

Page 13: online chatting

The following figure shows the evolution of the Intranet from the time of its conception -

By 2000 A.D, Intranets will be provide complete functionality which is now provided by

network operating systems. Also, far-flung networks of an organization will be connected

using the Internet as the intermediate medium. Thus centralized administration, better

utilization of resources will improve productivity with better turn around time.

1997 - 1998

1994 - 1996

1999 - 2000

Intranet e-mail file n/w manage

Intranet e-mail file n/w manage directory

NOS e-mail print file directory

NOS print file directory

Full ServiceIntranet e-mail print directory file n/w manage directory

Page 14: online chatting

Requirements for an Intranet:

The following table summarizes the requirements of an Intranet

Intranet requirements

Requirement Importance Description Examples

Network Essential The NOS shouldsupport TCP/IP. A separate intranetserver can be connected

IntranetWareWindows NT

TCP/IP Essential Should be installedon all servers and nodesin the intranet. Novell NetWare willrequire an IPX/IPgateway

Server Essential To provide mail andweb services Unix generally hasbuilt-in mail

A Pentium-166 32-64 Mb RAM 2 Gb SCSI HDD

Web browsers Essential Universal front-endto mail, WebPages etc. Should follow currentstandards in HTML,CGI etc.

Internet ExplorerNetscapeNavigator

Page 15: online chatting

I/O STREAMS

Input & Output Streams in JAVA:

The concepts of streams: In JAVA, an object from which we can read a

sequence of bytes is called an input stream. An object to which we can write

a sequence of bytes is called an output stream. Some of the input streams

supported by Java are:

Input Stream

Buffered Input Stream

Data Input Stream

File Input Stream

String Buffer Input Stream

Character Input Streams are virtually identical to the input streams listed

above except that they operate on characters rather than on bytes. The

character input stream classes are called readers instead of input streams. The

purpose of providing character-based versions of the input stream classes is to

help facilitate the internalization of character information.

The basic reader classes provided by JAVA are:

Reader

Buffered Reader

File Reader

String Reader

The Input Stream Class: It is an abstract class that serves as a base class for

all other input stream classes. Input Stream defines a basic interface for

reading streamed bytes of information.

The Buffered Input Stream Class: It provides a buffered stream of input.

More data is read into the buffered stream than might have been requested,

Page 16: online chatting

subsequent reads come straight out of the buffer rather than the input device

resulting in much faster read access.

The Data Input Stream Class: It is useful for reading primitive JAVA data

types from an input stream in a portable fashion. The File Input Stream Class

is useful for performing simple file input.

Some of the Output streams supported by JAVA are

Output Stream

Print Stream

Buffered Output Stream

Data Output Stream

File Output Stream

Java also supports character output stream classes called Writers. The basic

Writer classes are

Writer

Print Writer

Buffered Writer

File Writer

The Output Stream Class: It serves as an abstract base class for all the

other output stream classes. Output Stream defines the basic protocol for

writing streamed data to an output device.

The Print Stream Class: The Print Stream class is derived from Output

Stream and is designed primarily for printing output data as text.

The Buffered Output Stream Class: It provides a buffered stream of output.

The Buffered Output Stream class maintains a buffer that is written to when

you write to stream. This output approach is much more efficient because

most of the data transfer takes place in memory.

Page 17: online chatting

The Data Output Stream Class: It is useful for writing primitive JAVA data

types to an output stream in a portable fashion.

The File Output Stream Class: It is useful for performing simple file

output.

MultiProgramming:

Multiprogramming is an attempt to increase CPU utilization by always

having something for the CPU to execute. The operating System picks one

job from the job pool and begins to execute it. Eventually, the job may have

to wait for an I/O operation. In a non-multiprogrammed system the CPU

would sit idle. In a multiprogrammed system, the operating system will

simply switch to another job and execute it. When that job needs to wait, the

CPU is switched to another job and so on. Eventually the first job will have

finished waiting and will get the CPU back. As long as there is always some

job to execute the CPU. will never be idle.

Multiprocessing:

In multiprocessing several processes appear to be executing simultaneously.

The CPU executes one process, and when the process is waiting for I/O

operations it can execute another process. The main difference between

multiprocessing and multithreading is that threads can use the same address

space, while processes necessarily execute on different address space. The

advantage of using threads is that no time is wasted for context switching.

Multithreading in JAVA:

One of the characteristics that make Java a powerful programming language

is that its support for multithreaded programming as an integrated part of the

language. Most modern programming languages either does not offer

multithreading or multithreading as a nonintegrated package. Java offers a

single integrated view of multithreading.

Page 18: online chatting

SYSTEM REQUIREMENTS

Intranet Chatting System is a network-based application. When we talk

about hardware and software, we have to mention the requirements on

both the Client and Server part.

JDK 1.1 Java Webserver, running on any platform.

ODBC drivers installed.

JDBC drivers installed.

Efficient enough to deal with multiple threads of processing.

Functional Java enabled browser (Netscape Navigator).

Java Script

Software and Hardware Requirements

Software Requirements:

Operating system: Windows 98, MS-DOS

Backend : MS-Access

Language : Java2.0 (JDBC)Java script

Driver : Microsoft ODBC for oracle.

Browser : Internet Explorer4.0

Page 19: online chatting

Hardware Requirements

CPU : Pentium 2.0

RAM : 32 MB

Hard disk : 1.74MB

Monitor : SVGA color monitor

Keyboard : 105 standard and mouse.

Server : Any Java enabled Web server.

Page 20: online chatting

Context Diagram

Login

User

IntranetMailingSystem

User Creatio Data Applet

Chat Server

Page 21: online chatting

DFD For User:

User Db

newuserUser

System CHAT

Page 22: online chatting

DFD FOR LOGIN:

Login

Not valid Valid

User

LogOutChat Server

Validationprocess

ModifyPassword

Page 23: online chatting

Data Flow Diagram For Chatting

Login

Logout Db

UserData

AppletChat

Server

Logout

Page 24: online chatting

CONCEPTS AND TECHNIQUES

The Java Packages:

Eight packages comprise the standard Java development environment.

1. The Java Language Package

The Java language package, also known as Java.lang, contains classes that

are core to the Java language. The classes in this package are grouped as

follows:

Object

The granddaddy of all classes--the class from which all others inherit.

Data Type Wrappers

A collection of classes used to wrap variables of a primitive data type:

Boolean, Character, and Double, Float Integer and Long.

Strings

Two classes that implement character data. The String and String Buffer

Classes is a thorough lesson on the use of both types of strings.

System and Runtime

These two classes provide let your programs use system resources. System

provides a system-independent programming interface to system resources

and Runtime gives you direct system-specific access to the runtime

environment. Using System Resources Describes both the System and

Runtime classes and their methods.

Page 25: online chatting

Threads

The Thread, Thread Death and Thread Group classes supplement the multi-

threading capabilities so important to the Java language.

The Java.lang package also defines the runnable interface. Runnable makes

it convenient for Java class to be active without sub classing the Thread

class. Through an example-oriented approach Threads of Control will teach

you about Java threads.

Classes

The Class provides a runtime description of a class and the Class Loader

class allows you to load classes into your program during runtime.

Math

The Math class provides a library of math routines and values such as pi.

2. The Java I/O Package

The Java I/O Package (Java.io) provides a set of input and output streams

used to read and write data to files or other input and output sources. The

classes and interfaces defined in Java.io are covered fully in Input and

Output Streams.

FEATURES OF JAVA

Distributed

Java has an extensive library of routines for coping with TCP/IP protocols

like HTTP and FTP Java applications can open and access across the Net

via URLs with the same ease as when accessing local file system.

Page 26: online chatting

We have found the networking capabilities of Java to be both strong and

easy to use. Anyone who has tries to do Internet programming using

another language will revel. How simple Java makes onerous tasks will like

opening a socket connection.

Robust

Java is intended for writing programs that must be readable in a Variety

ways. Java puts a lot of emphasis on early checking for possible problems,

later dynamic checking, and eliminating situations that are error prone. The

single biggest difference between Java has a pointer model that eliminates

the possibility of overwriting memory and corrupting data.

The Java compiler detects many problems that in other languages would

only show up at runtime. As for the second point, anyone who has spent

hours chasing a memory leak cost by a printer bug will be very happy with

this feature of Java.

Java gives you the best of both worlds. You need not pointers for everyday

constructs like string and arrays. You have the power of pointers if you

need it, for example, for like lists. And you have always-complete safety,

since you can never access a bad pointer or make memory allocation errors.

Secure

Java is intended to be used in networked/distributed environment toward

that end; a lot of emphasis has been placed on security. Java enables the

contraction of virus-free, temper-free systems.

Here is a sample of what Java’s security features are supposed to keep a

Java programming from doing:

1. Overrunning the runtime stack.

2. Corrupting memory outside its own process space.

3. Reading or writing local files when invoked through a security-

Page 27: online chatting

Portable

Unlike C and C++, they are no "implementation dependent" aspects of the

specifications. The sizes of the primitive’s data types are specified, as is

the behavior of arithmetic on them.

For example, an int in Java is always a 32-bit integer. In C/C++, int can

mean a 16-bit integer, a 32-bit integer, or any size the compiler vendor

likes. The only restriction is that it must have at least as many bytes int

and cannot have more bytes than a long int.

The libraries that are a part of the system define portable interfaces. For

example, there is an abstract window class and implementations of it

UNIX, Windows, and the Macintosh.

Interpreted

The Java interpreters can execute Java byte codes directly on any machine

to which the interpreter has been ported. Since linking is a more

incremental and lightweight process, the development process can be

much more rapid and explanatory.

One problem is that the JDK is fairly slow at compiling your source code

to the bytecode that will, ultimately, be interpreted in the current version.

High Performance

While the performance of interpreted bytecode is usually more than

adequate, there are situations higher performance is required. The

bytecode can be translated on fly into machine code for the particular

CPU the application is running on.

Page 28: online chatting

Multithreaded

In a number of ways, Java is more dynamic language than C or C++. It

was designed to adapt to an evolving environment. Libraries can freely

add new methods and instance variables without any effect on their

clients.... In Java, finding out run time type information is

straightforward.

This is an important feature in those situations where code needs to be

added to a running program. A prime example is code that is downloaded

from the Internet to run in browser.

JAVA VS C++

The syntax of Java looks very much like C++. Compared to c++, Java

used similar syntax for if and for loop constructs. The notion of a

constructor is all very similar to what C++ has.

The following are some of the differences of Java over C++. If you

understand these differences you will see why Java is such a beneficial

programming language.

Compare to C++ Java runs 20 times slower because of platform

independents.

Every thing must be in a class. There are no global functions or global

data. If you want the equivalent of global, make static methods and static

data within a class. There are no structures or enumeration or unions.

Only class.

Page 29: online chatting

The Char type uses the international 16-bit. Unicode character set, so

it can automatically represent most national characters.

All non-primitive types can only be created using new. All primitive

types can only be created directly, without new. There are wrapper

classes for all primitive classes so you can create equivalent heap-based

objects with new

Java has no Preprocessors. If you want to use classes in another

library, you say import and the name of the library. There are no

preprocessor-like macros.

There are no Java pointers in the sense of C and C++. When you

create an object with new, you get back a reference. For example

String s = new String ("peers");

Java has no templates or other implementation of parameterized types.

There is a set of containers : Vectors, stacks and Hash table that hold

object references, and through which you can satisfy your container

needs, but these containers are not designed for efficiently like the C++

standard template library(STL)

Page 30: online chatting

Object-Oriented Programming Concepts:

What is all the fuss about objects and object-oriented technology? Is it

real? Or is it hype? Well, the truth is – it’s a little bit of both. Object-

oriented technology does, in fact, provide many benefits to software

developers and their products. However, historically a lot of hype has

surrounded this technology, causing confusion in both managers and

programmers alike. Many companies fell victim to this hardship (or

took advantage of it) and claimed that their software products were

object-oriented when, in fact, they weren’t. These false claims

confused consumers, causing widespread misinformation and mistrust

of object-oriented technology.

However, in spite of overuse of the term object-oriented, the

computer industry is now beginning to overcome the hype.

Understanding is growing about this technology and its benefits.

Object:

An object is a software bundle of variables and related methods.

Software objects are often used to model real-world objects you find

in everyday life.

Messages:

Software objects interact and communicate with each other using

messages.

Classes:

A class is a blueprint or prototype that defines the variables and the

methods common to all objects of a certain kind.

Page 31: online chatting

Inheritance:

A class inherits state and behavior from its superclass. Inheritance

provides a powerful and natural mechanism for organizing and

structuring software programs.

What is an Object?

As the name Object-Oriented implies, objects are key to

understanding object-oriented technology. You can look around you

now and see many examples of real-world objects: your dog, your

desk, your television set, your bicycle etc.

These real-world objects share two characteristics they all have

behavior. For example, bicycles have state (current gear, current

pedal, cadence, two wheels, number of gears) and behavior (breaking,

accelerating, slowing down, changing gears). Software objects are

modeled after real world objects in that they, too, have state and

behavior. A software object maintains its state in variables and

implements its behavior with methods.

Definition: An object is a software bundle of variables and related

methods.

In many languages, including Java, an object can choose to expose its

variables to other objects allowing those other objects to inspect and

even modify the variables. Also, an object can choose to hide

methods from other objects forbidding those objects from invoking the

methods. An object has complete control over whether other objects

can access its variables and methods and in fact, can specify which

other objects have access. Variable and methods access in Java.

Page 32: online chatting

The benefits of Encapsulation:

Encapsulating related variables and methods into a neat software

bundle is a simple yet powerful idea that provides two primary

benefits to software developers.

Modularity:

The source code for an object can be written and maintained

independently of the source code for other objects.

What are Classes?

Definition: A class is a blueprint or prototype that defines the

variables and methods common to all objects of a certain kind.

The values for instance variables are provided by each instance of the

class. So, after you’ve created the bicycle class, you must instantiated

it (create an instance of it) before you can use it. When you create an

instance of a class, you create an object of that type and the system

allocates memory for the instance variables declared by the class.

Then you can invoke the object’s instance methods to make it do

something. Instances of the same class share the same instance

method implementations (method implementations are not duplicated

on a per object basis), which reside in the class itself.

In addition to instance variables and methods, classes can also define

class variables and class methods. You can access class variables and

methods from an instance of the class or directly from a class – you

don’t have to instantiated a class to use its class variables and

methods. Class methods can only operate on class variables – they do

not have access to instance variables or instance methods.

The system creates single copy of all class variables for a class the first

time it encounters the class in a program – all instances of that class share

its class variables. For example, suppose that all bicycles had the same

Page 33: online chatting

number of gears. In this case defining an instance variable for number of

gears is inefficient – each instance would have its own copy of the

variable, but the value would be the same for every instance.

Objects vs. Classes:

You probably noticed that the illustrations of objects and classes look

very similar to one another. And indeed, the difference between

classes and objects is often the source of some confusion. In the real

world it’s obvious that classes are not themselves the objects that they

describe – a blue print of a bicycle is not a bicycle. However, it’s little

more difficult to differentiate classes and objects in software. This is

partially because software objects are merely electronic models of real

world objects or abstract concepts in the first place. But it’s also

because many people use the term “object” inconsistently and use it to

refer to both classes and instances.

What is Inheritance?

Generally speaking, objects are defined in terms of classes. You

know a lot about an object by knowing its class. Object-oriented

systems take this a step further and allow classes to be defined in

terms of other classes. For example, mountain bikes, racing bikes, and

tandems are all different kinds of bicycles. In object-oriented

terminology, mountain bikes, racing bikes and tandems are all sub

classes of the bicycle class. Similarly, the bicycle class is the super

class of mountain bikes, racing bikes, and tandems.

Page 34: online chatting

BIBILOGRAPHY

1. JAVA COMPLETE REFERENCE ----- PATRICKNAUGHTON,HERBERT SCHILDT

2. JAVA HOW TO PROGRAM ----- DEITEL & DEITEL

3. CORE JAVA 1.1 ----- CAY S.HORSTMANN,GARY CORNELL

4. SOFTWARE ENGINEERING ----- FAIRELY,PRESSMAN

5. SYSTEM ANALYSIS AND DESIGN ----- JAMES A. SENN

Web Sites

1. www.javasoft.com

2. www.sun.com