You are on page 1of 98


Sub co$e: %&&'() C* //: II MCA 0 Sect"o#

Co##ect"#g to t.e I#ter#et
I#ter#et co!!u#"c t"o# 1rotoco*/ Computers connected to the internet communicate by using Internet Protocol (IP). IP slices information into packets and routes them to their destination. IP uses dynamic routing, so that even if one part of the network is knocked out, packets can be rerouted. Along with IP, most computers on the internet communicate with CP.

I#ter#et .o/t/ !ach computer on the internet is called a host computer or host. Computers on the internet are connected by cables, phone lines and satellite connections. hey include large mainframe, smaller mini computers and PCs.

IP A$$re// !ach host computer on the internet has a uni"ue number called its IP address. IP addresses identify the host computers, so that packets reach the correct computer. If we use dial#up account, I$P assigns your computer an IP address each time you connect. Computers on %A& usually have IP addresses that are reserved for use on %A&. he most common IP assignment server is called '(CP ('ynamic (ost Configuration Protocol).

I#ter#et Ser-"ce Pro-"$er/ 2ISP/3 It is an organi)ation that provides Internet accounts.

he other features provided by the Internet account are !mail mailbo*es, +eb server space and 'omain hosting.

T+1e/ o4 I#ter#et Co##ect"o#/ o connect to the internet we have different types of connections. hey are, D" *5U1 co##ect"o#/ o his works over an ordinary phone line. o It uses the point#to#point protocol. A modem is needed. DSL co##ect"o#/ o 'igital $ubscriber %ine is a digital, high#speed line that uses the normal phone wires with special modems on either end. o he line is asymmetric, because it has more capacity for data received by the computer than for data sent from the computer. o +ith '$% line we can connect the computer to the internet and talk on the phone at the same time on the same phone line. o '$% modems connect to the computer through an !thernet or other network card in the computer ISDN Co##ect"o#/ o Integrated $ervices 'igital &etwork is an upgraded phone line that can be used for faster internet access and for regular voice calls. o -sing one line, we can talk on the phone and surf the web. o .or residential use I$'& provides /0I. 1n one line, /0I provides two 23# 4bps channels, or / channels, and one 52#4bps channel, or ' channel. o ' channel is used for signaling. he two / channels are combined for to use the internet. o An I$'& adapter is needed to connect the computer to an I$'& line. o line. o %eased lines come in various speeds including 6 and 7. Le /e$ L"#e/ If large amount of data is to be transferred we can go for leased

C b*e T6 "#ter#et co##ect"o#/ o Cable modem service brings do)ens of 8 channels as well as web sites. o he cable network was designed to move information in one direction, from the broadcaster to the user. o 'ownstream speeds are much faster than the upstream speed.

S te**"te I#ter#et Co##ect"o#/ o 'igital satellite $ystems or direct broadcast satellite lets to get internet information by satellite. o +ith early satellite systems, we can receive data from the internet at a high speed through the satellite, but to send data we need a dial#up connection and an I$P. o %ater the companies $tar/and and 'irecPC offered two#way system connection that doesn9t use a phone line at all, with uploads and downloads by satellite.

W"re*e// I#ter#et Co##ect"o#/ o In a few urban areas wireless internet access can be used. o o set it up, a radio modem is attached to the laptop. o Another way to connect to the internet via wireless is by using a digital cell phone. o $ome I$Ps offer wireless connections to Personal 'ata Assistants (P'A) such as /lackberry, Compa" ipa", or Palm. hese small devices have tiny screens which can be used to read e#mail and browse the web. Do! "# N !e S+/te! he name of each host computer consists of a series of words separated by dots. he last part of the domain name is called the top#level domain ( %'). he last two parts of a host computer name constitute the domain. he second to last part of the name (second#level#domain) is chosen by the organi)ation that owns the computer. !g, /ecause most organi)ations own more than on computer on the internet, most host computer names have at least one more part, preceding the domain name called third# level#domain. !g,, A domain name system ('&$) server translates between the numeric IP addresses that identify each host computer on the internet and the corresponding domain names.

E5M "* Co#ce1t/

!#mail messages are passed through the internet by using a protocol called simple mail transfer protocol. he incoming messages are received in an e#mail mailbo* that resides on a mail server. :ail servers receive and store e#mail messages in mailbo*es by using a protocol called Post office Protocol or I:AP. o read e#mail, a mail client is needed. +e can write e#mail messages by using e#mail application,

he messages are transferred to an $: P server# a mail server that accepts e#mail.

W +/ O4 cce//"#g E5! "* +e may use a mail client. !g, !udora, 1utlook, 1utlook e*press, &etscape :essenger etc. +e may use a web#based e#mail service. +e may use an online service, such as America online, which has its own mail program. +e may get e#mail through a %A&, a common system at large organi)ations. he e#mail arrives in the company9s P1P or I:AP server.

E5! "* A$$re//"#g Internet e#mail addresses consists of two parts ;oined by < sign. -ser name = It contains characters other than letters#they can contain numbers, underscores, periods, and some other special characters. hey can9t contain commas or parantheses. (ost or domain name = It provides the internet location of the mailbo*, usually the name of a company or internet service.

For! tte$ E5! "* HTML 7 his is formatted with ( :% tags, ;ust like web pages. It includes te*t formatting, numbering, bullets, alignment, hori)ontal lines, backgrounds, hyperlinks. It is actually sent using the :I:! protocol. R"c. Te8t For! t = his format can be read by most word processing applications. 'ocuments in this format are also called 0 . files. MIME 2Mu*t"1ur1o/e I#ter#et M "* E8te#/"o#/3 = It is used for attachments. .ormatting includes te*t formatting, pictures, video and sound.

Web50 /e$ E5! "* -sing web based email we can access the web as well as read our mail. :ost web#based e#mail is free. +e can read two kinds of messages on the web , o :essages sent to a web#only account o :essages stored in the P1P mailbo*

Se#$"#g #$ Rece"-"#g F"*e/ b+ E5! "*

Att c.!e#t/ An attachment is a file that has been encoded as te*t so that it can be included in an e# mail message. he three common ways to encode e#mail attachments are , o MIME 5 :ulti purpose Internet :ail !*tension is the standard method. o Ue#co$"#g 7 his method is supported by some older e#mail applications. o 0"#He85 -sed by some :ac e#mail programs.

Se#$"#g Att c.!e#t/ o send a file by e#mail, create a message to which the file is to be attached. Address the mail as usual and type the sub;ect. If needed type the te*t in the body of the message. &ow attach the file by choosing a menu command or by clicking a toolbar button. %arge files can be compressed, so that the sending and downloading time can be minimi)ed.

Rece"-"#g Att c.!e#t/ :ost e#mail applications store the attachments in the mail message. .irst, open the message and then open or save the attachment. +hen the message with an attachment is deleted, the attachment is also deleted. o use the attachment later, it has to be saved.

Att c."#g 4"*e/ to M"cro/o4t Out*oo9 e5! "* o attach files to a :icrosoft 1utlook, follow the below steps. 5. 1pen :icrosoft 1utlook. >. 0eply to an e*isting e#mail, or compose a new e#mail by clicking on the &ew icon in the top left portion of the window. 7. In the e#mail, click on the ?Insert file? icon that looks like a small paperclip, or click on Insert at the top of the window and choose file. 3. /rowse to the location that contains your file and double#click it insert it. If successfully attached you should see an icon of the attachment in your e#mail. /elow is an alternative method of attaching a file into an e#mail.

5. 1pen :y computer or +indows e*plorer and browse to the location of where your pictures are located. >. (ighlight and copy the picture you wish to send in an e#mail. 7. 1pen a new e#mail or the e#mail you?re replying to that you wish to attach the file into, right#click in the message portion of the e#mail and click paste.

F"g.t"#g S1 !: Sort"#g M "*: #$ A-o"$"#g E! "* 6"ru/e/

Re$uc"#g S1 ! he term @spam@ is Internet slang that refers to unsolicited commercial email (-C!) or unsolicited bulk email (-/!).
o o o o o o o o o o

$ome people refer to this kind of communication as ;unk email to e"uate it with the paper ;unk mail that comes through the -$ :ail. -nsolicited email most often contains advertisements for services or products, but very few reputable marketers use -C! to advertise. he most commonly seen spam includes the following, .oreign bank scams or advance fee fraud schemes Phishing scams, a very popular and dangerous form of email fraud Pyramid schemes, including multilevel marketing (:%:) 1ther @Aet 0ich Buick@ or @:ake :oney .ast@ (::.) schemes Buack health products and remedies Ads for pornographic web sites 1ffers of software for collecting email addresses and sending -C! 1ffers of bulk emailing services for sending -C! Chain letters (for more information, see About chain mail) Illegally pirated software

A-o"$ rece"-"#g /1 ! e! "* $pam has increasingly become a problem on the Internet. +hile every Internet user receives some spam email, certain behaviors on the Internet will cause you to receive even more than average. In fact, the .ederal rade Commission and the Center for 'emocracy and echnology have performed studies to determine how spammers can obtain your email address. hey found that email addresses posted to web sites or in newsgroups attract the most spam.

Chat rooms are also fertile places for spammers to obtain email addresses. $ome tips on Internet behavior that will help reduce the amount of spam you receive,

1n 1ctober 5C, >DD2, -I $ implemented enhanced email filtering services at Indiana -niversity. he spam "uarantine service now analy)es all mail delivered to I- CyrusE+ebmail and !*change accounts. Any spam messages you receive are "uarantined for five days in a $pam (CyrusE+ebmail) or Funk !#mail (!*change) folder in your account. After five days, the spam service deletes these messages automatically. !very time you communicate on the Internet or browse a web site, there are opportunities for spammers to intercept your communications to obtain your email address. In particular, if you post to a -senet newsgroup, list your email address on a web site, or fill out insecure forms on the web, your address can be collected by spammers. hey collect lists of email addresses and even share or sell these lists to other spammers. !ven otherwise reputable companies may sell or e*change your email address with other companies, and this information may inadvertently find its way to a spammer. At worst, spammers will use automated programs to bombard these lists of email addresses with spam.

Consider the following to reduce the amount of spam you receive, o $ubscribe only to essential discussion lists, and ensure that they are moderated. o If you are thinking of filling out a form on a web site, check the site?s privacy policy first to be sure it uses secure technology and the company does not share your email address with others. If the site doesn?t have a privacy policy that describes this to your satisfaction, consider not using that service. o If you post to -senet newsgroups or bulletin boards, or if you spend time in chat rooms or use an online service that displays your address, you may wish to consider opening an email account on a free service and using that address when performing these potentially spam#inducing activities. hen your primary account would not be as affected by spam. o If the email address is listed on a web page, you should also consider opening a free account. If the web site listing your contact information is for Indiana -niversity business, you could also get a departmental account and list that address rather than your personal address. o If you reply to spam, the spammer or the automated program on the other end will then know that your address is connected to a live person, and the spammer will then

bombard you with even more spam, and circulate your address to other spammers. hus, it is imperative that you pause and think before replying to any spam. Ho; to -o"$ -"ru/e/ 'o &1 open or view any attachment or file in email that you are not e*pecting. !ven if you know the person sending you a file, it does not mean that the file is safe. &ewer email viruses can make it look as if your friendsEcolleagues are sending you the file. In short, whenever you receive a file by email, C(!C4 with the sender directly that the file is legitimate and if it is not, contact your I support area. .ollowing this rule will keep you safe from the vast ma;ority of viruses going around the internet.

Ge#er * gu"$e*"#e/ 4or -o"$"#g co!1uter -"ru/e/ 5. 'o not run, download or forward any unsolicited e*ecutables, documents, spreadsheets, etc. Anything that runs on your PC should be virus checked and approved first. >. Any email you weren?t e*pecting should be treated with suspicion, even if it comes from someone you know. It is worth calling whoever sent it to you to check that they intended to send you the email. 7. &!8!0 open any files with a double file e*tension, (e.g. iamavirus.t*t.vbs). -nder normal circumstances you should never need to receive or use these. 3. Avoid downloading e*ecutables or documents from the internet. hese are often used to spread computer viruses. G. Although FPA, AI. and :P7 files are not normally infected with viruses, some viruses can be disguised as these file types, also some recent software problems with image viewers andEor mp7 players have allowed them to contain viruses. $ome caution is recommended when opening these file types. Fokes, pictures, graphics, screensavers and movie files should be treated with the same amount of suspicion as other file types. 2. If in doubt, contact the I $ $ervice 'esk for advice, do not open the file or email. C. If you think you have been infected with a virus inform the I $ $ervice 'esk immediately. 'o not panic or interrupt other users. H. Any virus warnings or hoa*es should be sent to the I $ $ervice 'esk who can help confirm whether or not it is genuine. 'o not forward these warnings to anyone elseI unless you are signed up to an official virus alert service it is unlikely to be a genuine warning. J. !nsure that you follow the same procedures at home and elsewhere. 8iruses can easily be spread from one location to another. 5D. 0 #9 Sc !/: Ignore emails from banks, unless you have explicitly asked the bank to communicate with you via e#mail.

!ven if you have e*plicitly asked a bank to communicate with you via e#mail, be cautious if you choose to enter your account details such as your account number or pin into a website supplied via e#mail, as it may be forged.

O#*"#e c. tt"#g: Me// g"#g: #$ Co#4ere#c"#g Co#ce1t/

1nline Chatting or online conferencing enables Internet users to e*change te*t or to have discussions with groups of people in real time. he groups of people involved may be anywhere in the world. his group communication can take the form of te*t, voice, or video, and messages and responses can be e*changed.

For!/ o4 C. t: Me// g"#g #$ Co#4ere#c"#g Re * 7t"!e c. t !ach participant sees each message with seconds of when it is sent, and the reply is given "uickly. (owever, all the participants need to be online at the same time. A/ c. t :essages are stored so that participants can read them when they have a chance, which allow participants to consider their responses, gather information, and formulate a response carefully. It also allows people from different time )ones or with different schedules to participate. T+1e/ o4 o#*"#e c. t #$ co#4ere#c"#g E5! "* M "*"#g L"/t/ 5 !#mail messages are sent to one or more people who are selected by the sender. An e#mail mailing list allows messages to be distributed to a list of preselected people, called subscribers. U/e#et Ne;/grou1/ 5 -senet is a system that allows messages to be distributed throughout the Internet. 'ue to the volume of messages, the messages are divided into newsgroups, or topics. I#ter#et Re* + C. t 2IRC3 5 It allows thousands of internet users to participate in real#time te*t#based chat. Web50 /e$ C. t 5 :any people are daunted by the programs and commands re"uired by I0C. (ence, many web sites now provide a web#based way to participate in real#time te*t# based chat.

AOL #$ Co!1u/er-e C. t Roo!/ 5 A1% services allow real#time chat on a wide variety of sub;ects. I#/t #t Me// g"#g 5 Instant messaging (I:) is a form of online communication that allows real#time interaction through computers or mobile devices. O#*"#e co#4ere#c"#g 5 An online conference uses the Internet as a conference venue. his means that participants can access the conference from anywhere in the world and can do this at any time, using standard browser software.

Ho; $oe/ C. t ;or9< he user?s web browser is used as the client software. Fava Application is often downloaded into the web browser to enable this function. +e will only be able to chat with users who are connecting to the same server. here are chat sections on all kinds of web

sites such as stock investing, sports, news, etc. In mailing lists and newsgroups, a person is identified by the name and e#mail address. housands of people can simultaneously participate in the various available forms of Internet chat and conferencing. 'iscussions are categori)ed by topic, enabling people who are interested in a particular topic to find and communicate with each other. 'epending on the system, topic groups may be called newsgroups (in -senet), Channels (in I0C), forums, boards, groups, or rooms.

O#*"#e Co#4ere#c"#g A$- #t ge/,,, raditional conferences mean participants have to travel and stay in a particular place. his takes time and is e*pensive. /ut an online conference uses the Internet as a conference venue. his means that participants can access the conference from anywhere in the world and can do this at any time, using standard browser software. Participants will be able to log on as little or as much as they wish # before, after or during office hours. hey are given a password to access the various conference and seminar groups as well as closed discussion groups. Anyone with access to the Internet can participate. Cheaper # because there is no travel, and no accommodation is re"uiredI :ore convenient # you can access it at any time you want, from anywhere with an Internet connectionI (igh level of participation # typically, more people will actively participate in an online conference than in a face to face conference, and the standard of the discussions is often higherI +ider spread of participants # our second $upporting 'eaf People conference had delegates from nineteen countries and five continentsI and there is a permanent record of proceedings. 1nline conferences are synchronous, asynchronous, or a combination of both. An e*ample of asynchronous conferencing is the discussion forum types of conference, where people post messages, which the system stores, and which other people can respond to when they log on.

S 4et+ W."*e C. tt"#g 5. &ever give out your personal information in a chat room. >. &ever agree to meet a stranger in person whom you met in a chat room. 7. +hen you?re asked to enter or sign up for a chat nickname, choose a name that doesn?t give away your personal information. 3. /e wary of other chatters who ask you to meet in private chat rooms.

G. Check the terms and conditions, code of conduct, and privacy statement at the chat site before you begin to chat.

U/e#et Ne;/grou1 Co#ce1t/

-senet newsgroups are electronic discussion groups in which you can share information and opinions with people all over the world. In -senet newsgroups, you can reply to articles you have read and publish (@post@) your own articles for others to read. &ewsgroups differ widely in sub;ect and style, ranging from casual chat to serious discourse.

Acce//"#g #e;/grou1/ If the Internet service provider (I$P) offers access to a news server, we can read newsgroups with newsreaders such as trn or tin, or we can use a desktop newsreader such as &etscape or 1utlook !*press. Re $"#g #e;/grou1/ Articles posted on newsgroups are distributed over the internet by news servers. hese servers store and forward -senet articles, and provide articles to users running news clients or newsreaders. &ews servers and newsreaders communicate by using an Internet protocol called the &etwork &ews ransfer Protocol (&& P). $ome of the popular newsreader software are &etscape messenger, outlook e*press, &etscape mailK newsgroups. 1ne of the most popular and reliable way to read -senet newsgroups on the web is through Aoogle. 1nce you have a news reader set up on your computer, reading and posting to newsgroups is relatively simple. Ste1( Aet your news server name from your I$P or network administrator. Ste1=

'etermine whether your current I$P software, e#mail program or +eb browser includes a news#reading utility (many do). If not, download and install one. Ste1' Configure your news reader by inputting your news server address and any other information it re"uests (it might ask for an e#mail address and mail server as well). Ste1) -se your reader to call up a list of available newsgroups. his list will probably pop up during setup the first time you use your reader.

Ste1> %ook through the hierarchical list of newsgroups to find any that sound interesting. %et the prefi*es of each group (such as ?comp? for computer#related topics and ?rec? for recreational topics) guide your search. he other words in the name go from general to more specific keywords. Ste1% $ubscribe to whichever newsgroups you want to read or post to. (&ote that some readers allow you to read newsgroup messages without your having to subscribe.) Ste1? $elect the newsgroup you want to read. Ste1@ $elect a message by double#clicking on the sub;ect. (&ote that different readers may have different ways of reading messages.) Ne;/grou1 ."er rc."e/ &ewsgroups are organi)ed and grouped by title using hierarchical compound names such as (ere, rec specifies recreational topics, sport specifies a subgroup of recreation, and so on. he /ig !ight mainstream hierarchies are,

co!1: Anything related to computers (e.g., programming languages, operating systems, hardware)

.u! #"t"e/: Art, music, literature, philosophy, classical studies, etc. !"/c: An assortment of topics that don?t fit in any of the other /ig !ight hierarchies #e;/: Pertaining to the administration and discussion of -senet software, protocols, policies, etc. rec: 0ecreation and hobbies of all kinds /c": Academic discussions of science and, to a lesser e*tent, technology /oc: (istory, culture, religion, politics, lifestyle, and other topics of social interest t *9: 'ebate and e*tended discussion, often heated

Alternative hierarchies have smaller distributions than their mainstream cousinsI each has its own rules and focus. hese hierarchies include,

*t: his is by far the largest and most diverse hierarchyI all manner of topics can be found here. As there is no formal newsgroup creation procedure, anyone may create an alt group at any time. .or this reason, many news servers either do not carry alt, or subscribe to only a small portion of its groups. b"A: Almost as well established as the mainstream groups, bi) caters to a variety of business interests. 9(=: his hierarchy contains groups designed for 4#5> educators.

&umerous national, regional, local, and organi)ational hierarchies also e*ist, some of which are available globally. Ne;/grou1 et"Buette If you decide to participate in a newsgroup, it?s best first to read a representative selection of articles over several days or even weeks before posting. (In the ;argon of some newsgroups, this is known as lurking.) !ach newsgroup may have its own set of guidelines for what constitutes an appropriate posting, and becoming familiar with the group before posting will help you show good manners (neti"uette) and avoid offending others. If you are new to -senet, consult the newsgroups news.newusers."uestions and news.announce.newusers to learn about techni"ue and neti"uette before posting. Lou can also find a large repository of -senet .AB (.re"uently Asked Buestion) files for a wide variety of newsgroups and sub;ects at the -senet .AB .iles site. It?s best to read any e*isting .AB for a newsgroup before posting so that you?ll avoid irritating other readers by asking "uestions that have already been answered many times. #e;/grou1

Cre t"#g

5) A re"uest for discussion on creation of a new newsgroup should be posted to news.announce.newgroups, news.groups, and any other groups or mailing lists at all related

to the proposed topic if desired. news.announce.newgroups is moderated, and the .ollowup#to, header will be set so that the actual discussion takes place only in news.groups. -sers on sites which have difficulty posting to moderated groups may mail submissions intended for news.announce.newgroups to newgroups< he proposal must be in the format defined in @(ow to .ormat and $ubmit a &ew Aroup Proposal@, a pointer to which is at the end of this message. he article should be cross#posted among the newsgroups, including news.announce.newgroups, rather than posted as separate articles. &ote that standard behaviour for posting software is to not present the articles in any groups when cross#posted to a moderated groupI the moderator will handle that for you. >) he name and charter of the proposed group and whether it will be moderated or unmoderated (and if the former, who the moderator(s) will be) should be determined during the discussion period. If there is no general agreement on these points among the proponents of a new group at the end of 7D days of discussion, the discussion should be taken offline (into mail instead of news.groups) and the proponents should iron out the details among themselves. 1nce that is done, a new, more specific proposal may be made, going back to step 5) above. 7) Aroup advocates seeking help in choosing a name to suit the proposed charter, or looking for any other guidance in the creation procedure, can send a message to group# advice<isc.orgI a few seasoned news administrators are available through this address.

I#ter#et Re* + C. t
Internet 0elay Chat is defined by networks of servers which communicate to each other. -sers connecting to any of the servers should able to chat with everyone else on that entire @network@. W. t "/ IRC< I0C (Internet 0elay Chat) is a multi#user, multi#channel chatting system. +e can use the computer and talk through typed messages with either one person or many other people from all over the Internet, all in real time.

Net;or9/: Ser-er/: #$ C. ##e*/ 1nce you are set up with a provider and a client, you are in control. Choose a nickname you wish to be known by, then connect to one of the many different IRC #et;or9/ catering to different geographical locations, interests, or philosophies. he largest networks have tens of thousands of people online at any given moment, drawn from an order of magnitude or more of regular visitors. hese people create thousands of channels (sometimes incorrectly called @chat rooms@) where people may meet and mingle. Lou may ;oin these channels and participate in the group discussion, or you may elect to chat privately with individuals. Conversations on a channel are like those at a party, everybody who is present hears everything that everybody else is saying. If somebody is late to the party or leaves early, however, they will not hear what is said in their absence. All channels on I0C have names starting with M, such as Mirchelp where you can get technical I0C help, or Mnew>irc where new users are welcome to ;oin and chat. -sually, the name of the channel shows what it?s for, but not always.

0 /"c IRC Co!! #$/ !very I0C client has an input area where you can type what you want to say or issue I0C commands. Lou issue I0C commands by typing on a new line something beginning with a E (forward slash) character.

Anything that does not begin with a E is assumed to be a message you are typing to someone or some channel. Commands you are supposed to type will be shown in re$, while te*t which you will see in response will be shown in b*ue. In addition, the graphical clients such as mI0C or Ircle allow you to use a mouse to point and click your way around I0C, so that you don?t have to type many of these commands manually. Lou should still learn the commands properly, because often they are the only way to specify precisely what you want done, and also they are often faster and easier than navigating through the labyrinth of buttons, menus, and dialogs that are supposed to make your life easier.

F"*e Tr #/4er In addition to talking, I0C has also become a popular and convenient way to e*change a wide variety of files. /e forewarned, however, that many people are getting into serious trouble by downloading files that seem interesting or enticing, only to find out they are attacks. hese hacks allow strangers to take over your channels, force you to disconnect, erase your hard disk, or worse. C. ##e* O1er tor/ Channel operators or @ops@ have absolute power over their channel, including the right to decide who gets to come in, who must leave, who may talk, etc. +hen you first start out, it?s best to chat on other people?s channels and heed their rules, or else you may find yourself kicked out. If that happens and you cannot settle your differences with the ops, ;ust go to another channel. At some point you will probably want to try your hand at being a channel op, either by creating your own new channel or by gaining the trust of the ops on an e*isting channel. Lou need to know a whole different set of commands. +ith this power comes the sometimes frustrating responsibility of maintaining the channel against intentional abuse as well as the usual I0C mishaps. $ome networks such as -ndernet and 'A%net support channel registration, whereby you can @reserve@ a channel. he advantage is that you are assured control over the channel as long as you show up once in a while, the disadvantage is that many popular channel names are probably already registered by others. wo of the largest nets !.net and I0Cnet do #ot support channel registration (or any other services).

1n these nets, there is #o way to ensure you will always control a channel. $ome channels try hard with all sorts of bots (which are e*plicitly banned by most servers) and protective scripts, but it?s really ;ust a matter of time before somebody with the right combination of lameness and knowledge comes along and takes over the channel.

About !IRC mI0C is a full featured I#ter#et Re* + C. t client for +indows that can be used to communicate, share, play or work with others on I0C networks around the world, either in multi#user group conferences or in one#to#one private discussions. It has a c*e #: 1r ct"c * "#ter4 ce that is highly configurable and supports features such as buddy lists, file transfers, multi#server connections, $$% encryption, pro*y support, - .#H display, customi)able sounds, spoken messages, tray notifications, message logging, and more. mI0C also has a 1o;er4u* /cr"1t"#g * #gu ge that can be used both to automate mI0C and to create applications that perform a wide range of functions from network communications to playing games. mI0C has been in development for over a decade and is constantly being improved and updated with new technologies.

I#/t #t !e// g"#g Instant messaging (I:) is a form of online communication that allows real#time interaction through computers or mobile devices. Although typed te*t remains the primary convention for I:, the technology now allows users to send images, audio and video files, and other attachments. (undreds of millions of people use I: to stay connected. In many ways, it epitomi)es the notion of the always#connected, multitasking student, sending and receiving messages at all hours, from a wide spectrum of devices, while doing several other things at the same time. I: has become such an integral part of students? lives that many colleges and universities are working to move it beyond the social sphere into teaching and learning.

he Internet has revolutioni)ed the way we communicate. !#mail has been the most rapidly adopted form of communication ever known. %ess than two decades ago, not many people had heard of it. &ow, many of us e#mail instead of writing letters or even calling people on the phone. People around the world send out billions of e# mail messages every day. /ut sometimes even e#mail isn?t fast enough. Lou might not know if a person you want to e#mail is online at that moment. Also, if you?re e#mailing back and forth with someone, you usually have to click through a few steps. his is why "#/t #t !e// g"#g (I:) has become so popular. +ith I:, you can keep a list of people you interact with. Lou can I: with anyone on your bu$$+ *"/t or co#t ct *"/t as long as that person is online. Lou type messages to each other into a small window that shows up on both of your screens. I#/t #t !e// ge/ # $end notes back and forth with a friend who is online C. t # Create a chat room with friends or co#workers Web *"#9/ # $hare links to your favorite +eb sites 6"$eo # $end and view videos, and chat face to face with friends I! ge/ # %ook at an image stored on your friend?s computer Sou#$/ # Play sounds for your friends F"*e/ # $hare files by sending them directly to your friends T *9 # -se the Internet instead of a phone to actually talk with friends Stre !"#g co#te#t # 0eal#time or near#real#time stock "uotes and news Mob"*e c 1 b"*"t"e/ # $end instant messages from your cell phone

Mo/t IM 1rogr !/ 1ro-"$e t.e/e 4e ture/:

8oice and 8ideo Conferencing

I#ter#et P.o#e Internet phone programs are designed to simulate phone calls over the internet, avoiding long#distance phone charges. !ach person on the internet phone call needs a computer with a microphone and speakers. hen, download and install an internet phone program and sign up for a user name on the system. Internet phone is one form of voice#over#IP = voice information transmitted over the internet. It is possible to call from a computer to someone9s telephone using 8oIP programs.

/ut these PC#to#phone programs need to use local phone lines to connect to the other person9s phone and the entire link is not over the internet.

6o"ce #$ 6"$eo Co#4ere#c"#g It can be PC#to#PC or PC#to#Phone, with two or more people in the conversation. It replaces conference calls, which get e*pensive when they include many people over long distances. 8oice conferencing enables user to send image to one or more people through a camera attached to the computer and to receive pictures back. +e can use voice or video conferencing (or both), depending on the peripherals connected to the computer and the conferencing software +ith voice and video conferencing we can talk to other people, see their faces, and transmit the video so that they can see us, too. A videoconference (also known as a videoteleconference) is a set of interactive te*eco!!u#"c t"o# tec.#o*og"e/ which allow two or more locations to interact via two# way video and audio transmissions simultaneously. It has also been called visual collaboration and is a type of grou1; re. It differs from -"$eo1.o#e in that it is designed to serve a conference rather than individuals

he core technology used in a video teleconference (8 C) system is digital compression of audio and video streams in real time. he hardware or software that performs compression is called a codec (coderEdecoder). Compression rates of up to 5,GDD can be achieved. he resulting digital stream of 5?s and D?s is subdivided into labelled packets, which are then transmitted through a digital network of some kind (usually I$'& or IP). he use of audio modems in the transmission line allow for the use of P1 $, or the Plain 1ld elephone $ystem, in some low#speed applications, such as videotelephony, because they convert the digital pulses toEfrom analog waves in the audio spectrum range.

he other components re"uired for a 8 C system include,

6"$eo "#1ut , video camera or webcam 6"$eo out1ut, computer monitor , television or pro;ector Au$"o "#1ut, microphones Au$"o out1ut, usually loudspeakers associated with the display device or telephone D t tr #/4er, analog or digital telephone network, %A& or Internet here are basically two kinds of 8 C systems,

5. De$"c te$ /+/te!/ have all re"uired components packaged into a single piece of e"uipment, usually a console with a high "uality remote controlled video camera. hese cameras can be controlled at a distance to pan left and right, tilt up and down, and )oom. hey became known as P N cameras. he console contains all electrical interfaces, the control computer, and the software or hardware#based codec. 1mnidirectional microphones are connected to the console, as well as a 8 monitor with loudspeakers andEor a video pro;ector. here are several types of dedicated 8 C devices, 5. %arge group 8 C are non#portable, large, more e*pensive devices used for large rooms and auditoriums. >. $mall group 8 C are non#portable or portable, smaller, less e*pensive devices used for small meeting rooms. 7. Individual 8 C are usually portable devices, meant for single users, have fi*ed cameras, microphones and loudspeakers integrated into the console. >. De/9to1 /+/te!/ are add#ons (hardware boards, usually) to normal PC?s, transforming them into 8 C devices. A range of different cameras and microphones can be used with the board, which contains the necessary codec and transmission interfaces. :ost of the desktops systems work with the (.7>7 standard. 8ideo conferences carried out via dispersed PCs are also known as e#meetings.

U#"t: II
Wor*$ W"$e Web Co#ce1t/
T.e H+1erte8t Co#ce1t
The hypertext is a way of presenting information in such a way that the sequence of the information is left up to the reader. This sequence is usually non-linear, however readers can follow a linear sequence. The hypertext works by means of hyperlink, which are highlighted or underlined words (or graphics) that one can click to bring another document into view.

Web 0ro;/er A web browser displays a web document and enables users to access web documents. +hen the user clicks a hyperlink, the browser initiates a message to a web server. his message re"uests the server to retrieve the re"uested information and send it back to the web browser through the telecommunications network.

Web Ser-er his is a program that waits patiently for the browser to re"uest a web page. he server looks for the re"uested information, retrieves it and sends it to the browser or sends an error message if the file is not found.

U#"4or! Re/ource Loc tor/ 2URL3 #$ Tr #/4er 1rotoco*/

These are the web addresses. The resource locator is an addressing system that precisely states where a resource is located. t is divided into four parts! protocol" server# domain name" path and the resource name. eg! .tt1:CC;;;,c"te/,u"uc,e$uC(&(Cur*(&(,.t!*

he first portion of the -0% (.tt1) designates the protocol that is used to locate the file or resource on the +eb. A protocol is a standardi)ed means of communication among machines across a network. Protocols allow data to be taken apart for faster transmission, transmitted, and then reassembled at the destination in the correct order. (ere, .tt1 represents the HyperText Transfer Protocol, which is used to transfer +eb pages across the Internet to +eb browsers such as &etscape &avigator, Internet !*plorer, or %yn*. he portion of the -0% following the protocol (;;;,c"te/,u"uc,e$u3 designates the host name of the computer you are accessing. he designator ;;;, found in many -0%s, is an acronym for +orld +ide +eb. +hile using ;;; is conventional, it is not necessary. $ome +eb servers omit the need to type ;;;.

A -0% may have any number of directories following it. In this e*ample, (&( is a directory under the root directory of the host you are accessing. he file ur*(&(,.t!* is located in the (&( directory.

Web L #gu ge/ ( :% ((yper e*t :arkup %anguage) o It is the universal language understood by all +++ (+orld +ide +eb) clients. o An ( :% document (program) is A$CII te*t with embedded instructions (markups) which affect the way the te*t is displayed. o he basic model for ( :% e*ecution is to fetch a document by its name (e.g. -0%), interpret the ( :% and display the document, possibly fetching additional ( :% documents in the process.

o It can accept user input andEor cause additional ( :% documents to be fetched by -0%. o Providing safety, platform independence, and the ability to interact with a variety of formats, protocols, tools, and languages makes it a universal language. Fava and Fava $cript o Fava is a language for sending applets over the web, so that the computer can e*ecute them. o Fava$cript is a language that allows ( :% to embed small programs called scripts in web pages. o he main purpose of applets and scripts is to speed up web page interactivity.

8/$cript and ActiveO Controls o 8/script resembles :icrosoft9s 8isual /asic and is used to add scripts to pages that are displayed by Internet e*plorer. o ActiveO controls, like Fava, are used to embed e*ecutable programs into a web page.

O:% o o o o o o o O:% stands for !Dtensible Markup Language O:% is a markup language much like ( :% O:% was designed to carry data, not to display data O:% tags are not predefined. +e must define our own tags O:% is designed to be self#descriptive O:% is a +7C 0ecommendation. O:% is not a replacement for ( :%. O:% and ( :% were designed with different goals. O:% was designed to transport and store data, with focus on what data is. ( :% was designed to display data, with focus on how data looks. ( :% is about displaying information, while O:% is about carrying information.

o +ith O:% we invent our 1wn ags. he tags in the e*ample below (like PtoQ and PfromQ) are not defined in any O:% standard. o PnoteQ PtoQ ovePEtoQ PfromQFaniPEfromQ PheadingQ0eminderPEheadingQ PbodyQ'on?t forget me this weekend6PEbodyQ PnoteQ hese tags are @invented@ by the author of the O:% document. hat is because the O:% language has no predefined tags. o he tags used in ( :% (and the structure of ( :%) are predefined. ( :% documents can only use tags defined in the ( :% standard (like PpQ, Ph5Q, etc.). O:% allows the author to define his own tags and his own document structure. o Port */ A portal is a web site that wants to be the start page. A portal site includes web guides, search engines, chat rooms, e#mail accounts and news services. All portal services are free but some re"uires registering and choosing a password. Corporations are replacing their internal homepages with portals.

Web $"rector"e/ #$ Se rc. E#g"#e/ A ;eb $"rector+ or *"#9 $"rector+ is a directory on the +orld +ide +eb. It speciali)es in linking to other web sites and categori)ing those links. A web directory is not a search engine, and does not display lists of web pages based on keywords, instead it lists web sites by category and subcategory. he categori)ation is usually based on the whole web site, rather than one page or a set of keywords, and sites are often limited to inclusion in only one or two categories. +eb directories often allow site owners to directly submit their site for inclusion, and have editors review submissions for fitness. A Web /e rc. e#g"#e is a search engine designed to search for information on the +orld +ide +eb. Information may consist of web pages, images and other types of files. $ome search engines also mine data available in newsgroups, databases, or open directories. -nlike +eb directories, which are maintained by human editors, search engines operate algorithmically or are a mi*ture of algorithmic and human input. A search engine operates, in the following order 5. +eb crawling >. Inde*ing 7. $earching +eb search engines work by storing information about many web pages, which they retrieve from the +++ itself. hese pages are retrieved by a +eb crawlerR an automated +eb browser which follows every link it sees. +hen a user enters a "uery into a search engine (typically by using key words), the engine e*amines its inde* and provides a listing of best#matching web pages according to its criteria, usually with a short summary containing the document?s title and sometimes parts of the te*t. :ost search engines support the use of the boolean operators A&', 10 and &1 to further specify the search "uery. $ome search engines provide an advanced feature called pro*imity search which allows users to define the distance between keywords.

Ho!e P ge/ he .o!e1 ge or ! "# 1 ge is the -0% or local file that automatically loads when a web browser starts and when the browser?s @home@ button is pressed. he term is also used to refer to the front page, webserver directory inde*, or main web page of a website of a group, company, organi)ation, or individual. In some countries, such as Aermany, Fapan, and $outh 4orea, and formerly in the -$, the term @homepage@ commonly refers to a complete website (of a company or other organi)ation) rather than to a single web page. Also, with more and more people knowing how to navigate the internet easily, the significance of choosing a homepage is almost non#e*istent. :any software companies now automatically set their company?s website as the user?s homepage.

Web Secur"t+: Pr"- c+: #$ S"te50*oc9"#g

Web Secur"t+ #$ Pr"- c+ Co#ce1t/ $tand#alone computers have $ecurity Policy associated with them that can be modified by users with the appropriate rights. +hen a computer ;oins a domain, the domain $ecurity Policy is applied to the local computer. 'omain $ecurity Policy will override any changes made to $ecurity Policy at the desktop level. +eb security defines what the browser will allow web pages to run or store on the computer. /rowsers have security policies, or systems that enable us to specify which web sites can take what types of actions on our computer. Another aspect of web security specifies what information web sites can store on the computer, to track our use of the web site.

Coo9"e/ Cookies are messages that web servers pass to the web browser when we visit Internet sites.

he browser stores each message in a small file, called cookie.txt.

+hen we re"uest another page from the server, the browser sends the cookie back to the server. hese files typically contain information about our visit to the web page, as well as any information we?ve volunteered, such as the name and interests.

Cookies are most commonly used to track web site activity. +hen we visit some sites, the server gives a cookie that acts as the identification card. -pon each return visit to that site, the browser passes that cookie back to the server. In this way, a web server can gather information about which web pages are used the most, and which pages are gathering the most repeat hits. Cookies are also used for online shopping. 1nline stores often use cookies that record any personal information we enter, as well as any items in the electronic shopping cart, so that user don?t need to re#enter this information each time we visit the site. $ervers also use cookies to provide personali)ed web pages. +hen we select preferences at a site that uses this option, the server places the information in a cookie. +hen we return, the server uses the information in the cookie to create a customi)ed page for us. Secur"t+ co#cer#/ "# coo9"e/ 1nly the web site that creates a cookie can read it. Additionally, web servers can use only information that you provide or choices that you make while visiting the web site as content in cookies. Accepting a cookie does not give a server access to the computer or any of the personal information (e*cept for any information that we may have purposely given, as with online shopping). $ervers can read only cookies that they have set, so other servers do not have access to the information. Also, it is not possible to e*ecute code from a cookie, and not possible to use a cookie to deliver a virus. P* t4or! 4or I#ter#et Co#te#t Se*ect"o# 2PICS3 he PICS specification enables labels (metadata) to be associated with Internet content. It was originally designed to help parents and teachers control what children access on the Internet, but it also facilitates other uses for labels, including code signing and privacy.

he PIC$ platform is one on which other rating services and filtering software has been built. PICS is a cross#industry working group whose goal is to facilitate the development of technologies to give users of interactive media, such as the Internet, control over the kinds of material to which they and their children have access. PIC$ members believe that individuals, groups and businesses should have easy access to the widest possible range of content selection products, and a diversity of voluntary rating systems. In order to advance its goals, PIC$ will devise a set of standards that facilitate the following, (, Se*45r t"#g, !nable content providers to voluntarily label the content they create and distribute. =, T."r$51 rt+ r t"#g, !nable multiple, independent labeling services to associate additional labels with content created and distributed by others. $ervices may devise their own labeling systems, and the same content may receive different labels from different services. ', E /e5o45u/e, !nable parents and teachers to use ratings and labels from a diversity of sources to control the information that children under their supervision receive.

Co#te#t5R t"#g Ser-"ce/: S 4e/ur4 #$ RSAC 2Recre t"o# * Sot; re A$-"/or+ Cou#c"*3 he two rating systems that are built into &etscape &etwatch are $afesurf and the 0ecreational $oftware Advisory. :icrosoft9s Content Advisor includes only 0$AC9s system. $afesurf is a parents9 group trying to make the internet a safe and useful tool for children. 0$AC is a nonprofit corporation and its mission was to issue a rating system for computer games, and it later e*tended its game#rating system to the Internet.

Au$"o #$ -"$eo o# t.e ;eb

+ith the increased popularity of broadband connections, many sites features music, movie, and television clips which can be viewed or download. (owever the audio or video files are large in si)e and take a long time to download.

$ince audio and video files are large, streaming was invented. $treaming enables the computer to play the beginning of an audio or video file while the rest of the file is still downloading. If the file arrives more slowly than the computer plays it, the playback has gaps while the computer waits for more data to play.

Po1u* r Au$"o #$ 6"$eo 1* +er/ Re *O#e P* +er = plays most popular audio formats and video files, including streaming audio and video. $upports burning audio files on C's, so we can create our own music C's. Eu"c9 T"!e 7 plays audio and video files stored in the Buicktime format.

W"#$o;/ Me$" P* +er 7 plays both regular and streaming audio and video files, including most audio files and C's. It supports burning to C's or copying files to portable media players that support +:A format. W"#A!1 7 plays :P7 and windows media files, as well as many other popular music formats, C's, and streaming audio. Mu/"cM tc. = plays :P7s and C's, copies and creates C's, transfers :P7s to portable media players, and supports internet radio broadcasts.

P* +"#g -"$eo o# t.e I#ter#et he video files are very large in si)e, meaning a video clip ;ust a few seconds long could take ten minutes or more to download. !ven using streaming media, where the content is played as it is downloaded, the images were often blocky and tiny. +ith improved video compression techni"ues and faster internet connections the rich multimedia content can be downloaded or played within seconds. Prerecor$e$ -"$eo o $everal video formats are in use on the internet.

o :any videos play in windows media player, whereas other videos re"uire 0eal1ne player or Buicktime player. o +e can view the prerecorded video clips using the right player. L"-e -"$eo ;"t. ;ebc !/ o Another source for video broadcasts is the ever#popular webcam. o hese are digital video cameras broadcast from a specific location

o +ebcam images are usually updated between every few seconds, although some sites use streaming video for their webcams.

Web /"te Cre t"o# Co#ce1t/

0 /"c /te1/ "# Cre t"#g /"te

5. Plan the structure of the site, so that we have an idea what information will be on at least the home page and other key pages. >. -sing the te*t editor or web page editor, create the pages of the site and save them as ( :% files. -se a graphics editor to create or view graphics for the pages. 7. -sing browser, view the ( :% files created. Check the contents and the links 3. Publish the web site by putting all of its files on a web server. G. -sing the browser, view the web pages as stored on the web server. 2. Publici)e the site, get feedback, get new ideas, and repeat the steps.

P* ##"#g t.e S"te he planning process involves answering these "uestions. 5. +ho is the audience for the siteS >. +hat can you put on the site that will interest peopleS 7. (ow can we make it easy for people to navigate the siteS

3. (ow the pages are stored on the siteS G. +hat are the tools needed to develop the siteS Issues to be aware of when planning the web site, 5. e*t si)e >. Colors 7. +riting for an international audience 3. Privacy G. :aintenance 2. Accessibility

Too*/ #ee$e$ to $e-e*o1 t.e /"te 5. e*t

>. Pictures 7. Animated graphics 3. Audio files G. 8ideo files 2. Animation files C. .orma and database information H. e*t editor

J. 'rawing programs 5D. Clip art gallery 55. $ound or video e"uipment

O1t"!"A"#g ;eb gr 1."c/

Gr 1."c/ F"*e 4or! t/ 5. 8ector images consist if lines and various shapes outlined and filled with colors or shadings. >. /itmap images consist of colored dots, or pi*els. +eb documents commonly use bitmap images in two formats, Araphics Interchange .ormat (AI.) and Foint Photographic !*perts Aroup (FP!A).

Co!!o# 1rogr !/ 4or cre t"#g GIF #$ JPEG 4"*e/ Aenerally, Araphics programs are of three varieties, 5. Paint and photo programs = !nables to read different image files and customi)e them for web use. !g, Adobe Photoshop and :acromedia fireworks >. Illustration programs = focus on creating images, principally vector graphics and have features for optimi)ing the bitmap files. !g, Adobe Illustrator and Corel'raw. 7. Araphics -tilities 5 small programs with simple features that focus on converting images from one format to another. Araphics program that are widely available, 5. :icrosoft Paint >. Adobe Photo$hop 7. Adobe Image0eady 3. :acromedia .ireworks G. Paint $hop Pro 2. %view pro

O1t"!"A"#g I! ge/ 5. he /est method to decrease file si)e for a +!/ image is to decrease the "uality. his does &1 mean the image will not look good on a computer monitor. >. 'igiti)ed images are normally at a much higher "uality (resolution E dots per inch) than a monitor can display.

7. 3. G.

2. C. H.

his step alone will normally reduce the file si)e to 5EG of the original. Physical si)e will not change (Avoid resi)e until final step). he $econd best method (optional) is to ?crop? off any ?dead? area. .or e*ample, center the sub;ect in the picture by cropping the borders. -sing ?resi)e? to reduce file si)e is &1 very effective. (usually no more than 5E> of the original si)e # even if we take the viewing si)e below 7>D * >3D ,( 0esi)e should be used to obtain the ?physical? si)e you desire i.e resi)ing # -sed alone results in an image that is not really optimi)ed very well. :inimi)e the image dimensions by using the smallest practical image height and width. :inimi)ing or avoiding certail types of Image content. :inimi)ing and flattening colors.

FTP #$ Peer5to51eer
F"*e Tr #/4er Protoco* (FTP) is a network protocol used to transfer data from one computer to another through a network, such as the Internet. . P is a file transfer protocol for e*changing and manipulating files over any CP#based computer network. A . P client may connect to a . P server to manipulate files on that server. As there are many . P client and server programs available for different operating systems, . P is a popular choice for e*changing files independent of the operating systems involved.

Co##ect"o# !et.o$/
. P runs e*clusively over CP. . P servers by default listen on port >5 for incoming connections from . P clients. A connection to this port from the . P Client forms the control stream on which commands are passed to the . P server from the . P client and on occasion from the . P server to the . P client. . P uses out#of#band control, which means it uses a separate connection for control and data. hus, for the actual file transfer to take place, a different connection is re"uired which is called the data stream. 'epending on the transfer mode, the process of setting up the data stream is different. In ct"-e !o$e, the . P client opens a dynamic port (3J5G>=2GG7G), sends the . P server the dynamic port number on which it is listening over the control stream and waits for a connection from the . P server. +hen the . P server initiates the data connection to the . P client it binds the source port to port >D on the . P server. In order to use active mode, the client sends a P10 command, with the IP and port as argument. he format for the IP and port is @h5,h>,h7,h3,p5,p>@. !ach field is a decimal representation of H bits of the host IP, followed by the chosen data port. .or e*ample, a client with an IP of 5J>.52H.D.5, listening on port 3J5G3 for the data connection will send the

command @P10 5J>,52H,D,5,5J>,>@. he port fields should be interpreted as p5T>G2 U p> V port, or, in this e*ample, 5J>T>G2 U > V 3J5G3. In 1 //"-e !o$e, the . P server opens a dynamic port (3J5G>=2GG7G), sends the . P client the server?s IP address to connect to and the port on which it is listening (a 52 bit value broken into a high and low byte, like e*plained before) over the control stream and waits for a connection from the . P client. In this case the . P client binds the source port of the connection to a dynamic port between 3J5G> and 2GG7G. o use passive mode, the client sends the PASV command to which the server would reply with something similar to @>>C !ntering Passive :ode (5>C,D,D,5,5J>,G>)@. he synta* of the IP address and port are the same as for the argument to the P10 command. In e8te#$e$ 1 //"-e !o$e, the . P server operates e*actly the same as passive mode, however it only transmits the port number (not broken into high and low bytes) and the client is to assume that it connects to the same IP address that was originally connected to. !*tended passive mode was added by 0.C >3>H in $eptember 5JJH. +hile data is being transferred via the data stream, the control stream sits idle. his can cause problems with large data transfers through firewalls which time out sessions after lengthy periods of idleness. +hile the file may well be successfully transferred, the control session can be disconnected by the firewall, causing an error to be generated. he . P protocol supports resuming of interrupted downloads using the 0!$ command. he client passes the number of bytes it has already received as argument to the 0!$ command and restarts the transfer. In some commandline clients for e*ample, there is an often#ignored but valuable command, @reget@ (meaning @get again@) that will cause an interrupted @get@ command to be continued, hopefully to completion, after a communications interruption. 0esuming uploads is not as easy. Although the . P protocol supports the APP! command to append data to a file on the server, the client does not know the e*act position at which a transfer got interrupted. It has to obtain the si)e of the file some other way, for e*ample over a directory listing or using the $IN! command. he ob;ectives of . P,are, 5. >. 7. 3. o promote sharing of files (computer programs andEor data). o encourage indirect or implicit use of remote computers. o shield a user from variations in file storage systems among different hosts. o transfer data reliably, and efficiently. t 4or! t

+hile transferring data over the network, several data representations can be used. he two most common transfer modes are, 5. A$CII mode >. /inary mode, In @/inary mode@, the sending machine sends each file byte for byte and as such the recipient stores the bytestream as it receives it. ( he . P standard calls this @I:AA!@ or @I@ mode) In @A$CII mode@, any form of data that is not plain te*t will be corrupted. +hen a file is sent using an A$CII#type transfer, the individual letters, numbers, and characters are sent using their A$CII character codes. he receiving machine saves these in a te*t file in the appropriate format (for e*ample, a -ni* machine saves it in a -ni* format, a +indows machine saves it in a +indows format). (ence if an A$CII transfer is used it can be assumed plain te*t is sent, which is stored by the receiving computer in its own format. ranslating between te*t formats might entail substituting the end of line and end of file characters used on the source platform with those on the destination platform, e.g. a +indows machine receiving a file from a -ni* machine will replace the line feeds with carriage return#line feed pairs. It might also involve translating charactersI for e*ample, when transferring from an I/: mainframe to a system using A$CII, !/C'IC characters used on the mainframe will be translated to their A$CII e"uivalents, and when transferring from the system using A$CII to the mainframe, A$CII characters will be translated to their !/C'IC e"uivalents. /y default, most . P clients use A$CII mode. $ome clients try to determine the re"uired transfer#mode by inspecting the file?s name or contents, or by determining whether the server is running an operating system with the same te*t file format. he . P specifications also list the following transfer modes, 5. !/C'IC mode # this transfers bytes, e*cept they are encoded in !/C'IC rather than A$CII. hus, for e*ample, the A$CII mode server >. %ocal mode # this is designed for use with systems that are word#oriented rather than byte#oriented.


#$ ;eb bro;/er/

:ost recent web browsers and file managers can connect to . P servers, although they may lack the support for protocol e*tensions such as . P$. his allows manipulation of remote files over . P through an interface similar to that used for local files. his is done via an . P -0%, which takes the form ftp(s)://PftpserveraddressQ (e.g., ftp,EEftp.gimp.orgE). A password can optionally be given in the -0%, e.g., ftp(s)://PloginQ:PpasswordQ@PftpserveraddressQ,PportQ. :ost web#browsers re"uire the

use of passive mode . P, which not all . P servers are capable of handling. $ome browsers allow only the downloading of files, but offer no way to upload files to the server. L"/t o4 FTP co!! #$/ Commands used by the . P client software as opposed to the user are often described as r ; FTP co!! #$/.

A/10 # Abort an active file transfer. ACC # Account information. A%%1 # Allocate sufficient disk space to receive a file. APP! # Append. C'-P # Change to Parent 'irectory. C%& # $end . P Client &ame to server. C+' # Change working directory. '!%! # 'elete file. !P$8 # !nter e*tended passive mode !P0 # $pecifies an e*tended address and port to which the server should connect. .!A # Aet the feature list implemented by the server. A! # -se to download a file from remote (!%P # 0eturns usage documentation on a command if specified, else a general help document is returned. %I$ # 0eturns information of a file or directory if specified, else information of the current working directory is returned. %P$8 # !nter long passive mode. %P0 # $pecifies a long address and port to which the server should connect :' : # 0eturn the last#modified time of a specified file. :A! # -se to download multiple files from remote. :4' # :ake directory (folder). :& # :ount .ile $tructure. :1'! # $ets the transfer mode ($tream, /lock, or Compressed). :P- # -se to upload multiple files to remote. &%$ # 0eturns a list of filenames in a specified directory. &11P # &o operation (dummy packetI used mostly on keepalives). 1P $ # $elect options for a feature. PA$$ # Authentication password. PA$8 # !nter passive mode. P10 # $pecifies an address and port to which the server should connect. P- # -se to upload a file to remote. P+' # Print working directory. 0eturns the current directory of the host. B-I # 'isconnect. 0!I& # 0e initiali)es the connection. 0!$ # 0estart transfer from the specified point. 0! 0 # 0etrieve (download) a remote file.

0:' # 0emove a directory. 0&.0 # 0ename from. 0& 1 # 0ename to. $I ! # $ends site specific commands to remote server. $IN! # 0eturn the si)e of a file. $:& # :ount file structure. $ A # 0eturns the current status. $ 10 # $tore (upload) a file. $ 1- # $tore file uni"uely. $ 0- # $et file transfer structure. $L$ # 0eturn system type. LP! # $ets the transfer mode -:& # -nmount file structure. -$!0 # Authentication username

Peer5to51eer Arc."tecture 1ften referred to simply as peer#to#peer, or abbreviated P>P, peer#to#peer architecture is a type of network in which each workstation has e"uivalent capabilities and responsibilities. his differs from clientEserver architectures where some computers are dedicated to serving the others. Peer#to#peer networks are generally simpler but they usually do not offer the same performance under heavy loads. he P>P network itself relies on computing power at the ends of a connection rather than from within the network itself. P>P is often mistakenly used as a term to describe one user linking with another user to transfer information and files through the use of a common P>P client to download :P7s, videos, images, games and other software. his, however, is only one type of P>P networking. Aenerally, P>P networks are used for sharing files, but a P>P network can also mean Arid Computing or Instant messaging. T+1e/ o4 P=P Net;or9/ Peer#to#peer networks come in three flavors. he category classification is based on the network and application.

Collaborative Computing Also referred to as distributed computing, it combines the idle or unused CP- processing power andEor free disk space of many computers in the network. Collaborative computing is most popular with science and biotech organi)ations where intense computer processing is re"uired. !*amples of distributed computing can be found at A0I'.10A where -nited 'evices is hosting virtual screening for cancer research on the Arid :P platform. his pro;ect has evolved into the largest computational chemistry pro;ect in history. -nited

'evices has harnessed the power of more than >,DDD,DDD PCs around the world to generate more than 5DD teraflops of power. :ost distributed computing networks are created by users volunteering their unused computing resources to contribute to public interest research pro;ects. Instant Messaging 1ne very common form of P>P networking is Instant :essaging (I:) where software applications, such as :$& :essenger or A1% Instant :essenger, for e*ample, allow users to chat via te*t messages in real#time. +hile most vendors offer a free version of their I: software others have begun to focus on enterprise versions of I: software as business and corporations have moved towards implementing I: as a standard communications tool for business. Affinity Communities Affinity communities is the group of P>P networks that is based around file#sharing and became widely known and talked about due to the public legal issues surrounding the direct file sharing group, &apster. Affinity Communities are based on users collaborating and searching other user?s computers for information and files. Ho; Peer5to51eer F"*e5/. r"#g C*"e#t/ Wor9 1nce you have downloaded and installed a P>P client, if you are connected to the Internet you can launch the utility and you are then logged into a central inde*ing server. his central server inde*es all users who are currently online connected to the server. his server does not host any files for downloading. he P>P client will contain an area where you can search for a specific file. he utility "ueries the inde* server to find other connected users with the file you are looking for. +hen a match is found the central server will tell you where to find the re"uested file. Lou can then choose a result from the search "uery and your utility when then attempt to establish a connection with the computer hosting the file you have re"uested. If a successful connection is made, you will begin downloading the file. 1nce the file download is complete the connection will be broken. A second model of P>P clients works in the same way but without a central inde*ing server. In this scenario the P>P software simply seeks out other Internet users using the same program and informs them of your presence online, building a large network of computers as more users install and use the software. P=P Secur"t+ Co#cer#/ 1ne ma;or concern of using P>P architecture in the workplace is, of course, network security. $ecurity concerns stem from the architecture itself. oday we find most blocking and routing handles by a specific server within network, but the P>P architecture has no single fi*ed

server responsible for routing and re"uests. he first step in securing your P>P network is to adopt a strict usage policy within the workplace. In securing your network against attacks and viruses there are two main strategies where focus is on controlling the network access or the focus is put on controlling the files. A protocol#based approach is where system administrators use a software or hardware solution to watch for and block intrusive network traffic being received through the P>P clients. A second method of protection is a software solution which would provide file surveillance to actively search for files based on their type, their name, their signature or even their content.

P=P t Wor9 P>P is not only popular with home users but many small business have come to rely on this cost#effective solution for sharing files with co#workers and clients. P>P promotes the ease of working together when you?re not physically located in the same office. In ;ust seconds updated files and data can be shared with peers and confidential files can be blocked for security. Additionally, companies can also block access to Internet music and video files to assist in maintaining a work#oriented P>P network. &ot only does this keep the company free and clear from legal issues regarding music downloading and sharing but it also keeps the corporate bandwidth usage down.

U#"t: III J - Fe ture/:

he basic features that make Fava a powerful and popular programming language are, P* t4or! I#$e1e#$e#ce o he +rite#1nce#0un#Anywhere ideal has not been achieved (tuning for different platforms usually re"uired), but closer than with other languages. Object Or"e#te$ o 1b;ect oriented throughout # no coding outside of class definitions, including main(). o An e*tensive class library available in the core language packages. Co!1"*erCI#ter1reter Co!bo o Code is compiled to bytecodes that are interpreted by Fava virtual machines (F8:). o his provides portability to any machine for which a virtual machine has been written.

o Robu/t

he two steps of compilation and interpretation allow for e*tensive code checking and improved security.

o !*ception handling built#in, strong type checking (that is, all data must be declared an e*plicit type), local variables must be initiali)ed. Se-er * $ #gerou/ 4e ture/ o4 C F CGG e*"!"# te$: o &o memory pointers o &o preprocessor o Array inde* limit checking Auto! t"c Me!or+ M # ge!e#t o Automatic garbage collection # memory management handled by F8:. Secur"t+ o &o memory pointers o Programs run inside the virtual machine sandbo*. o Array inde* limit checking o Code pathologies reduced by o bytecode verifier # checks classes after loading o Class loader # confines ob;ects to uni"ue namespaces. Prevents loading a hacked @;ava.lang.$ecurity:anager@ class, for e*ample. o $ecurity manager # determines what resources a class can access such as reading and writing to the local disk. D+# !"c 0"#$"#g o he linking of data and methods to where they are located is done at run#time.

o &ew classes can be loaded while a program is running. %inking is done on the fly. o !ven if libraries are recompiled, there is no need to recompile code that uses classes in those libraries. his differs from CUU, which uses static binding. his can result in fragile classes for cases where linked code is changed and memory pointers then point to the wrong addresses.

Goo$ Per4or! #ce o Interpretation of bytecodes slowed performance in early versions, but advanced virtual machines with adaptive and ;ust#in#time compilation and other techni"ues now typically provide performance up to GDW to 5DDW the speed of CUU programs. $"#g o %ightweight processes, called threads, can easily be spun off to perform multiprocessing. o Can take advantage of multiprocessors where available o Areat for multimedia displays. 0u"*t5"# Net;or9"#g o Fava was designed with networking in mind and comes with many classes to develop sophisticated Internet communications.

J - P* t4or!:
he Fava platform is the name for a bundle of related programs, or platform, from Sun which allow for developing and running programs written in the Fava programming language. he platform is not specific to any one processor or operating system, but rather an e*ecution engine (called a virtual machine) and a compiler with a set of standard libraries that are implemented for various hardware and operating systems so that Fava programs can run identically on all of them. 'ifferent @editions@ of the platform are available, including, Fava :! (:icro !dition), $pecifies several different sets of libraries (known as profiles) for devices which are sufficiently limited that supplying the full set of Fava libraries would take up unacceptably large amounts of storage. Fava $! ($tandard !dition), .or general purpose use on desktop PCs, servers and similar devices. Fava !! (!nterprise !dition), Fava $! plus various APIs useful for multi#tier client#server enterprise applications.

J - Fu#$ !e#t */,

Fava is a $trongly yped %anguage.

he Fava Compiler checks all e*pressions and parameters to ensure that the types are compatible.

'ata ypes, It has !ight $imple 'ata types which can be put in four groups, they are, Integers, b+te, /.ort, "#t, and *o#g for whole valued signed numbers. .loating#point numbers, 4*o t, and $oub*e for fractional precision. Characters, c. r for representing symbols in character set. /oolean, boo*e # a special type for representing trueEfalse. 8ariables, he basic unit of storage in Fava Program. And is defined by the combination of an identifier, a type, and an optional initializer. he synta* for declaring a variable is, type identifier XV valueY X ,identifier X V valueYZYI e.g., int a V G, bV2I ype Conversions and Casting, Fava9s Automatic Conversions, he wo types are compatible. he destination type is larger then the source type.

Casting Incompatible ypes, Also called as narrowing conversions, since we are e*plicitly making the value narrower so that it will fit into the target type. Arrays, An array is a group of variables of the same data type and referred to by a common name. An array is contiguous block of memory locations referred by a common name. !.g. charXY sI ClassXY 1b;I %ike all ob;ects we use the new keyword to create an array. s V new charX5DYI A cast is simply a e*plicit type conversion. he general form is ( target type) value e.g. int aI byte bI b V (byte) aI

ypes of Arrays, 1ne 'imensional Array. type array[name XYI EEtype is the datatype of the array. :ulti = 'imensional Array. type array[name V new type XrowsY XcolsYI

In Fava, arithmetic, boolean, and $tring e*pressions are written in conventional mathematical infi* notation, adapted to the standard computer character set (called A$CII). .or e*ample, the $cheme e*pression (and (< ( (! x x" (! y y"" #$" (% x &"" is written in Fava as (x!x (x % &." y!y % #$" ''

O1er tor/:
Fava provides a rich operator environment. And it can be classified into four groups as, Arithmetic, -sed in mathematical e*pressions. hey are, U, #, \, E. /itwise, It operates on individual bits of integer values. hey are, K, ], ^, 0elational, It compares two values and determines the relationship between them. hey are, VV, 6V, P, Q, PV, and QV %ogical, It is an easy way to handle multiple conditions. hey are, KK, ]] and, 6.

Co#tro* Structure/:
$tatements that support repetition and conditional e*ecution are called control statements or control structures. hey are of two type, hey are, o /ranching $tatements, # hey are (f and Switch $tatements. o %ooping $tatements, # hey are for, while, and do)while loops.

S"!1*e I4 St te!e#t:
$ynta*, if ( !*pression ) $tatement. $emantics, he e*pression must be of type boolean. If it evaluates to true, the given statement is e*ecuted, otherwise not.

&ote that there is only one statement. o e*ecute more than one statement conditionally, a block statement is to be used. !*ample, int *V7I if (* Q >) _ $ystem.out.println(@ he value of * is greater than >.@)I `

I4 7 E*/e St te!e#t:
$ynta*, if ( !*pression ) $tatement5 else $tatement> $emantics, !*ample, EE guess 6V secret&umber if (guess P secret&umber) _ $ystem.out.println(@ oo small6@)I ` else _ EE guess Q secret&umber $ystem.out.println(@ oo large6@)I ` he e*pression must be of type boolean. If it evaluates to true, $tatement 5 is e*ecuted, otherwise $tatement>.

Ne/te$ I4 7 E*/e St te!e#t:

he e*ecution evaluates all conditional e*pressions beginning from !*pression5 until the first e*pression is found that evaluates to true. hen the corresponding statement se"uence is e*ecuted, or, if none of the e*pressions evaluated to true, the statement se"uence of the final else part. !*ample,

if (guess VV secret&umber) _ $ystem.out.println(@Congratulations6@)I ` else if (guess P secret&umber) _ $ystem.out.println(@ oo small6@)I ` else _ EE guess Q secret&umber $ystem.out.println(@ oo large6@)I ` $witch $tatements, Switch statements are shorthand9s for a certain kind of if statement. It allows for any number of possible e*ecution paths. It works with the byte, short, char, and int primitive data types. It also works with enumerated types (discussed in Classes and Inheritance) and a few special classes that @wrap@ certain primitive types, !*ample, int month V HI switch (month) _ case 5, $ystem.out.println(@Fanuary@)I breakI case >, $ystem.out.println(@.ebruary@)I breakI case 7, $ystem.out.println(@:arch@)I breakI case 3, $ystem.out.println(@April@)I breakI case G, $ystem.out.println(@:ay@)I breakI case 2, $ystem.out.println(@Fune@)I breakI case C, $ystem.out.println(@Fuly@)I breakI case H, $ystem.out.println(@August@)I breakI

case J, $ystem.out.println(@$eptember@)I breakI case 5D, $ystem.out.println(@1ctober@)I breakI case 55, $ystem.out.println(@&ovember@)I breakI case 5>, $ystem.out.println(@'ecember@)I breakI default, $ystem.out.println(@Invalid month.@)IbreakI `

For Loo1:
he for is Fava9s multipurpose loop controller. $ynta*, for ( Init$tatement I !*pression5 I !*pression> ) $tatement $emantics, he for loop comes close to a while construct, !*ample, int factorial V 5I for (int countV5I count P 55I countUU) _ $ystem.out.println(factorial \V count)I `

W."*e Loo1:
$ynta*, while ( !*pression ) $tatement. $emantics, he e*pression must be of type boolean. If it evaluates to false, the given statement is skipped, 1therwise it is e*ecuted and afterwards the e*pression is evaluated again. If it is still true, the statement is e*ecuted again. his is continued until the e*pression evaluates to false. !*ample, int count V 5I while (count P 55) _ $ystem.out.println(@Count is, @ U count)I countUUI

Do 7 W."*e Loo1:
$ynta*, do $tatement while ( !*pression )I $emantics, he statement is e*ecuted first and then the e*pression is evaluated which must be of boolean type. As long the e*pression remains true, the statement is e*ecuted repeatedly. he while statement evaluates the condition first and then, as long it remains true, e*ecutes the statement repeatedly. In case of the do statement the condition is not evaluated before the first iteration is performed. !*ample, int count V 5I do _ $ystem.out.println(@Count is, @ U count)I countUUI `while (count PV 55)I

C* //e/:
Fava classes contain fields and methods. A field is like a CUU data member, and a method is like a CUU member function. !ach field and method has an access level, private, accessible only in this class (package), accessible only in this package protected, accessible only in this package and in all subclasses of this class public, accessible everywhere this class is available

$imilarly, each class has one of two possible access levels, (package), class ob;ects can only be declared and manipulated by code in this package public, class ob;ects can be declared and manipulated by code in any package

!*ample, Class :yClass

_ int 0oll&oI $tring &ameI void get'etails()I void disp'etails()I ` In Fava, all classes (built#in or user#defined) are (implicitly) subclasses of 1b;ect. -sing an array of 1b;ect in the %ist class allows any kind of 1b;ect (an instance of any class) to be stored in the list. (owever, primitive types (int, char, etc) cannot be stored in the list. EE :ember 8ariable EE :ember 8ariable EE :ember .unction EE :ember .unction

1b;ects are key to understanding ob;ect#oriented technology. 1b;ect is an instance (or instantiation) of a class. hree properties characteri)e ob;ects, o Identity, the property of an ob;ect that distinguishes it from other ob;ects o $tate, describes the data stored in the ob;ect o /ehavior, describes the methods in the ob;ect?s interface by which the ob;ect can be used !*ample, public static void main($tring argsXY) _ :yClass c5 V new :yClass()I EEc5 is the 1b;ect of the Class :yClass :yClass c>I EE declare reference to 1b;ect c> V new :yClass()I EEAllocate a :yClass 1b;ect ` he new 4eyword is used to allocate memory dynamically

A method is a set of Fava statements which can be included inside a Fava class. hey are similar to functions or procedures in other programming languages.

he only re"uired elements of a method declaration are the method?s return type, name, a pair of parentheses, (), and a body between braces, _`. he general from is return)type method#name(parameters)list) _ EE body of the method `

!*ample, void printdetails() _ $ystem.out.println(aPrint 'etailsb)I ` :ore generally, method declarations have si* components, in order, o :odifiersRsuch as public, private, and others you will learn about later. o o o he return typeRthe data type of the value returned by the method, or void if the method does not return a value. he method nameRthe rules for field names apply to method names as well, but the convention is a little different. he parameter list in parenthesisRa comma#delimited list of input parameters, preceded by their data types, enclosed by parentheses, (). If there are no parameters, you must use empty parentheses. o An e*ception listRto be discussed later. o he method body, enclosed between bracesRthe method?s code, including the declaration of local variables, goes here.


Constructors have one purpose in life, to create an instance of a class. his can also be called creating an ob;ect Constructors and methods differ in three aspects of the signature, modifiers, return type, and name. %ike methods, constructors can have any of the access modifiers, public, protected, private, or none. Constructors cannot be a*stract, final, native, static, or synchronized. !*ample, public class Platypus _ $tring nameI Platypus($tring input) EE +onstructor with a Parameter _ name V inputI ` Platypus() _ this(@FohnE:ary 'oe@)I ` public static void main($tring argsXY) _ Platypus p5 V new Platypus(@digger@)I Platypus p> V new Platypus()I ` ` Constructors and methods use the keyword this "uite differently. It refers to the instance of the class that is e*ecuting the method. $tatic methods do not use thisI they do not belong to a class instance, so this would have nothing to reference. EE +onstructor without a Parameter

G rb ge Co**ect"o#:

he Fava virtual machine?s heap stores all ob;ects created by a running Fava application. referenced by the program.

Aarbage collection is the process of automatically freeing ob;ects that are no longer It relieves programmers from the burden of freeing allocated memory. In addition to freeing unreferenced ob;ects, a garbage collector may also combat heap fragmentation. /efore an ob;ect is garbage collected, the runtime system calls its finalize(" method. It takes no arguments and returns no results. his method can be overridden to perform some tidying up tasks when an ob;ect is garbage collected.

Met.o$ O-er*o $"#g:

he concept of defining two or more methods within the same class that share the same name, as long as their parameter declarations are different is called as :ethod 1verloading. !ach overloaded method must take a uni"ue list of argument types. +hen an overloaded method is called, ;ava uses the type andEor number of arguments to decide which version of the overloaded method to actually call. he important points to note, A difference in return type only is not sufficient to constitute an overload and is illegal. Lou should restrict your use of overloaded method names to situations where the methods really are performing the same basic function with different data. he language treats methods with overloaded names as totally different methods and as such they can have different return types. (owever, since overloaded methods perform the same ;ob with different data sets, they should produce same return type normally. here is one particular condition, however, under which it is sensible to define different return types. his is the situation where the return type is derived from the argument type and is e*actly parallel with the arithmetic operators. 1verloaded methods may call one another simply by providing a normal method call with an appropriately formed argument list. !*ample,

class 1verloading _ void test() _ $ystem.out.println(@&o parameters@)I ` void test(int a, int b) _ $ystem.out.println(@a and b, @ U a U @ @ U b)I ` void test(float a) _ $ystem.out.println(@Inside test(double) a, @ U a)I ` ` class 1verload _ public static void main($tring argsXY) _ 1verloading ob V new 1verloading()I int i V HHI ob.test()I ob.test(5D, >D)I ob.test(i)I ob.test(5>7.>)I ` ` In ;ava, Constructor can be overloaded provided they should have different arguments because F8: differentiates constructors on the basis of arguments passed in the constructor. Constructors should not have any return type. his is called as constructor overloading."t #ce:
Inheritance is the capability of a class to use the properties and methods of another class while adding its own functionality. It has the following advantages, you can customi)e and enhance working classes it is easier to reuse code you can take a more general class and modify to suit a particular situation

he concept of inheritance greatly enhances the ability to reuse code as well as making design a much simpler and cleaner process. he synta* for creating a subclass is simple. At the beginning of your class declaration, use the e*tends keyword, followed by the name of the class to inherit from, he $ynta* is, class :ountain/ike e*tends /icycle _ EE new fields and methods defining a mountain bike would go here `

!*ample, class Person _ private $tring nameI public void set&ame($tring n) _ name V nI ` public $tring get&ame() _ return nameI ` ` ` ` ` public $tring get$tu&um() _ return stu&umI class $tudent e*tends Person _ private $tring stu&umI public void set$tu&um($tring sn) _ stu&um V snI

public class estInheritance _ public static void main($tringXY args) _ $tudent stu V new $tudent()I stu.set&ame(@Fohn $mith@)I stu.set$tu&um(@5>73G@)I $ystem.out.println(@$tudent &ame, @ U stu.get&ame())I $ystem.out.println(@$tudent &umber, @ U stu.get$tu&um())I ` `

Met.o$ O-err"$"#g:
:ethod 1verriding is achieved when a subclass overrides non#static methods defined in the superclass, following which the new method implementation in the subclass that is e*ecuted. he new method definition must have the same method signature (i.e., method name and parameters) and return type. he new method definition cannot narrow the accessibility of the method, but it can widen it.


class Circle _ protected double radiusI public Circle(double radius) _ this.radius V radiusI ` public double getArea() _ return :ath.PI\radius\radiusI ` ` class Cylinder e*tends Circle _ protected double lengthI public Cylinder(double radius, double length) _ super(radius)I this.length V lengthI ` public double getArea() _ return >\super.getArea()U>\:ath.PI\radius\lengthI ` ` class 1ver0iding _ public static void main($tring argsXY) _ Circle myCircleI

myCircle V new Circle(5.>D)I Cylinder myCylinderI myCylinder V new Cylinder(5.>D,>.GD)I ` `

Ab/tr ct C* //e/:
An abstract class is a class that is declared abstractRit may or may not include abstract methods. Abstract classes cannot be instantiated, but they can be subclassed. An abstract method is a method that is declared without an implementation (without braces, and followed by a semicolon), like this, abstract void move o(double deltaO, double deltaL)I +hen an abstract class is subclassed, the subclass usually provides implementations for all of the abstract methods in its parent class. (owever, if it does not, the subclass must also be declared abstract. An abstract class may have static fields and static methods. Lou can use these static members with a class referenceRfor e*ample, AbstractClass.static:ethod() Ras you would with any other class. !*ample, abstract class 8ehicle _ int numofAearsI $tring colorI abstract boolean has'isk/rake()I abstract int get&oofAears()I `

P c9 ge/:
A package is a grouping of related types providing access protection and name space management. &ote that types refers to classes, interfaces, enumerations, and annotation types. he types that are part of the Fava platform are members of various packages that bundle classes by function, fundamental classes are in ;ava.lang, classes for reading and writing (input and output) are in ;, and so on. o create a package, you choose a name for the package (naming conventions are discussed in the ne*t section) and put a package statement with that name at the top of every source file that contains the types. !.g. package graphicsI If you do not use a package statement, your type ends up in an unnamed package. Aenerally speaking, an unnamed package is only for small or temporary applications or when you are ;ust beginning the development process. 1therwise, classes and interfaces belong in named packages. !*ample, package worldI public class (ello+orld _ public static void main($tringXY args) _ $ystem.out.println(@(ello +orld@)I ` `

I#ter4 ce:
An interface is a group of related methods with empty bodies. Implementing an interface allows a class to become more formal about the behavior it promises to provide. Interfaces form a contract between the class and the outside world, and this contract is enforced at build time by the compiler.

If your class claims to implement an interface, all methods defined by that interface must appear in its source code before the class will successfully compile. !*ample, interface /icycle _ void changeCadence(int new8alue)I void changeAear(int new8alue)I void speed-p(int increment)I void apply/rakes(int decrement)I ` class AC:!/icycle implements /icycle _ EE remainder of this class implemented as before `

E8ce1t"o# H #$*"#g:
An e*ception is an event that occurs during the e*ecution of a program that disrupts the normal flow of instructions. +hen an error occurs within a method, the method creates an ob;ect and hands it off to the runtime system. the error occurred. Creating an e*ception ob;ect and handing it to the runtime system is called throwing an exception. he set of possible @somethings@ to handle the e*ception is the ordered list of methods that had been called to get to the method where the error occurred. he list of methods is known as the call stac, he runtime system searches the call stack for a method that contains a block of code that can handle the e*ception. handler. his block of code is called an exception he ob;ect, called an e*ception ob;ect, contains information about the error, including its type and the state of the program when

he e*ception handler chosen is said to catch the e*ception. If the runtime system e*haustively searches all the methods on the call stack without finding an appropriate e*ception handler, the runtime system (and, conse"uently, the program) terminates.

Co!!o# E8ce1t"o#/:
Arithmetic!*ception##thrown if a program attempts to perform division by )ero ArrayInde*1ut1f/ounds!*ception##thrown if a program attempts to access an inde* of an array that does not e*ist $tringInde*1ut1f/ounds!*ception##thrown if a program attempts to access a character at a non#e*istent inde* in a $tring &ullPointer!*ception##thrown if the F8: attempts to perform an operation on an 1b;ect that points to no data, or null &umber.ormat!*ception##thrown if a program is attempting to convert a string to a numerical datatype, and the string contains inappropriate characters (i.e. ?)? or ?B?) Class&ot.ound!*ception##thrown if a program can not find a class it depends at runtime (i.e., the class?s @.class@ file cannot be found or was removed from the C%A$$PA () I1!*ception##actually contained in ;, but it is thrown if the F8: failed to open an IE1 stream !*ample, try _ /uffered0eader in V new /uffered0eader(new .ile0eader(userInput))I $ystem.out.println( ` catch(I1!*ception e) _ $ystem.err.println(e.get:essage())I $ystem.err.println(@!rror, @ U userInput U @ is not a valid file. Please verify that the file e*ists and that you have access to it.@)I $ystem.e*it(5)I `

U#"t: I6 AWT P c9 ge:

A+ stands for Abstract +indow ool4it. It is a portable A-I library between $olaris and +indows JGE& and :ac $ystem C.O(soon) for stand#alone applications andEor applets. It provides many classes for programmers to use. It is your connection between your application and the native A-I. he A+ hides you from the underlying details of the A-I your application will be running on and thus is at very high level of abstraction. Components are added to and then laid out by layoutmanagers in Containers. here are two user#interface classes in the A+ to focus on, Components and Containers. Containers, Containers (.rames, 'ialogs, +indows and Panels) can contain components and are themselves components, thus can be added to Containers. Containers usually handle events that occurred to the Components, although nothing prevents you from handling events in the component. he method of handling events in the Container (i.e. .rame) is preferred over the latter, since we want to centrali)e event handling. All Containers have common functionality, due to the fact they are derived from Container which includes many pre#defined event handling methods. hese events are useful for handling user input in a speciali)ed (i.e. sub# class or derived) Container class where you?d override the default behavior such as the appearance (i.e. font, color, etc.) by overriding the methods. $ome common methods are, add(Component)


add($tring, Component) remove(Component) getComponents() set%ayout(%ayout:anager) get%ayout()

hey are generally the stuff that the user interacts with. visible -I controls that the user interacts with, all of which have been added to a Container.

Components are /uttons, e*tAreas, $crollbars, etc. in other words the

$ome common methods are, get/ackground() set/ackground(Color) get.ont() set.ont(.ont) mouse'own(!vent, int, int) show() resi)e(int, int) paint(Araphics) update(Araphics) move(int, int)

L +out M # ger:
(ow Components are @laid out@ within a Container is described by the %ayout:anager class. $ince the %ayout:anager class is abstract, we can not use it directly. +e must sub#class it and provide our own functionality or use a derived class of %ayout:anager (i.e. /order%ayout, Card%ayout, Arid%ayout, etc) already created for us. here are man different layout schemes, but the ones pre#defined for us are

/order%ayout his scheme lays out the Component in G ways &orth # &orthern part of the Container $outh # $outhern part of the Container !ast # !astern part of the Container +est # +estern part of the Container Center # Centered in the Container Card%ayout # Allows for what +indows programmers have called for years @tabbed dialogs@ or dynamic dialogs(now available on all versions of &etscape). Arid%ayout # Allows for the layout of Components in a grid #like fashion rather than @&orth@ or @Center@. Arid/ag%ayout # ( :% able#ish style of layout .low%ayout # Allows for Component to be laid out in a row(or flow) and aligned(left, right, center). &one # &o layout, the Container will not attempt to reposition the Components during a update.

o use a layout we must call set%ayout() for the Container with an instance of a %ayout:anager. ypes of %ayout available are, .low %ayout, It is the default layout manager for most components. It lays out components hori)ontally, !*ample, public class .lowApplet e*tends FApplet _ EE Add an instance of .lowPanel to the applet. public void init () _ Container content[pane V getContentPane ()I EE Create an instance of a FPanel sub#class .lowPanel flow[panel V new .lowPanel ()I

EE And add one or more panels to the FApplet panel. content[pane.add (flow[panel)I ` EE init ` EE class .lowApplet

E\\ A simple e*ample of a Panel with five buttons. \\E class .lowPanel e*tends FPanel _ .lowPanel () _ EE 'efault for FPanel is .low%ayout add (new F/utton (@1ne@) )I add (new F/utton (@ wo@) )I add (new F/utton (@ hree@) )I add (new F/utton (@.our@) )I add (new F/utton (@.ive@) )I ` EE ctor ` EE class .lowPanel /order%ayout, Arranges up to five components in five positions, Center, !ast, +est, &orth, and $outh. !*ample, public class /orderApplet e*tends FApplet _ public void init () _ Container content[pane V getContentPane ()I EE Create an instance /orderPanle /orderPanel border[panel V new /orderPanel ()I EE And add it to the applet panel.

content[pane.add (border[panel)I ` EE init ` EE class /orderApplet E\\ Arrange five buttons using a /order%ayout. \\E class /orderPanel e*tends FPanel _ /orderPanel () _ set%ayout ( new /order%ayout () )I add (/order%ayout.!A$ , new F/utton (@!ast@) )I add (/order%ayout.+!$ , new F/utton (@+est@) )I add (/order%ayout.&10 (, new F/utton (@&orth@) )I add (/order%ayout.$1- (, new F/utton (@$outh@))I add (/order%ayout.C!& !0, new F/utton (@Center@) )I ` EEctor ` EEclass /orderPanel Arid%ayout, Place components in a 0ow vs Column matri*. Components fill slots starting on top row, left to right, then move to ne*t row down. !*ample, public class AridApplet e*tends FApplet _ public void init () _ Container content[pane V getContentPane ()I EE Create an instance of a FPanel sub#class AridPanel grid[panel V new AridPanel ()I EE And add one or more panels to the FApplet panel. content[pane.add (grid[panel)I

` EE init ` EE class AridApplet E\\ A sample FPanel class for holding components. \\E class AridPanel e*tends FPanel _ AridPanel () _ set%ayout ( new Arid%ayout (7, >))I add (new F/utton (@1ne@) )I add (new F/utton (@ wo@) )I add (new F/utton (@ hree@) )I add (new F/utton (@.our@) )I add (new F/utton (@.ive@) )I ` EE ctor ` EE class AridPanel Arid/ag%ayout, he most powerful layout manager is the Arid/ag%ayout shown below. It is very useful when you have an elaborate interface with lots of components. Arid/ag%ayout places a component according to the settings in an instance of the helper class Arid/agConstraints. !*ample, E\\ 'emo of Arid/ag%ayout. \\E public class Arid/agApplet e*tends FApplet_ public void init () _ Container content[pane V getContentPane ()I EE Create an instance of the Arid/agPanel Arid/agPanel grid[bag[panel V new Arid/agPanel ()I EE And add it to the applet?s panel. content[pane.add (grid[bag[panel)I ` EE init

` EE Arid/agApplet E\\ Create a FPanel with G buttons and use Arid/ag%ayout manager.\\E class Arid/agPanel e*tends FPanel _ Arid/agConstraints constraints V new Arid/agConstraints ()I Arid/agPanel () _ set%ayout (new Arid/ag%ayout ())I EE Create a 7 row grid EE .ill the grid s"uares with the component EE in both * and y directions constraints.fill V Arid/agConstraints./1 (I EE 4eep same weight in vertical dimension constraints.weighty V 5.DI EE op row will include three components, each EE weighted differently in * D, D constraints.weight* V 5.DI constraints.grid* V DI constraints.gridy V DI add (new F/utton (@D,D@), constraints )I EE D,5 constraints.weight* V D.GI constraints.grid* V 5I constraints.gridy V DI add (new F/utton (@5,D@), constraints )I EE D,> constraints.weight* V D.5I constraints.grid* V >I constraints.gridy V DI add (new F/utton (@>,D@), constraints )I EE :iddle row has two components. .irst takes up two EE rows, second takes up two columns EE he first component on second row will span

EE vertically to third row EE D,5 to D,> constraints.weight* V 5.DI constraints.grid* V DI constraints.gridy V 5I constraints.gridheight V >I add (new F/utton (@D,5 to D,>@), constraints )I EE he second component on second row will span EE hori)ontally to third column EE 5,5 to >,5 constraints.weight* V 5.DI constraints.grid* V 5I constraints.gridy V 5I constraints.gridheight V 5I constraints.gridwidth V >I add (new /utton (@5,5 to >,5@), constraints )I EE /ottom row has > components with fill set to &1&! EE -se anchor. constraints.fill V Arid/agConstraints.&1&!I EE 5,> constraints.anchor V Arid/agConstraints.$1- (!A$ I constraints.weight* V D.GI constraints.grid* V 5I constraints.gridy V >I constraints.gridheight V 5I constraints.gridwidth V 5I add (new F/utton (@5,>@), constraints )I EE >,> constraints.anchor V Arid/agConstraints.+!$ I constraints.weight* V D.5I constraints.grid* V >I constraints.gridy V >I constraints.gridheight V 5I

constraints.gridwidth V 5I add (new F/utton (@>,>@), constraints )I ` EE ctor ` EE class Arid/agPanel

E-e#t P c9 ge:
he ;ava.awt.event package defines classes and interfaces used for event handling in the A+ and $wing. he members of this package fall into three categories, !vents he classes with names ending in @!vent@ represent specific types of events, generated by the A+ or by one of the A+ or $wing components. %isteners he interfaces in this package are all event listenersI their names end with @%istener@. hese interfaces define the methods that must be implemented by any ob;ect that wants to be notified when a particular event occurs. &ote that there is a %istener interface for each !vent class.

Adapters !ach of the classes with a name ending in @Adapter@ provides a no#op implementation for an event listener interface that defines more than one method. +hen you are interested in only a single method of an event listener interface, it is easier to subclass an Adapter class than to implement all of the methods of the corresponding %istener interface.

Act"o# E-e#t:
An ob;ect of this class represents a high#level action event generated by an A+ component.

Instead of representing a direct user event, such as a mouse or keyboard event, Action!vent represents some sort of action performed by the user on an A+ component. he get(-(" method returns the type of action that has occurred. he getAction+ommand(" method returns a $tring that serves as a kind of name for the action that the event represents. get.odifiers(" returns a value that indicates the keyboard modifiers that were in effect when the action event was triggered. EE he general type is public class Action!vent e*tends A+ !vent _ Public Constructors public Action!vent (1b;ect source, int id, $tring command)I public Action!vent (1b;ect source, int id, $tring command, int modifiers)I EE Public Constants public static final int AC I1&[.I0$ I public static final int AC I1&[%A$ I public static final int A% [:A$4 I VH public static final int C 0%[:A$4 IV> public static final int :! A[:A$4 I public static final int $(I. [:A$4 I EE Public Instance :ethods public $tring getActionCommand ()I public int get:odifiers ()I EE ` Public :ethods 1verriding A+ !vent public $tring param$tring ()I V3 V5 V5DD5 V5DD5 V5DD5

public static final int AC I1&[P!0.10:!' I

his interface defines the method that an ob;ect must implement to listen for action events on A+ components.

+hen an Action!vent occurs, an A+ component notifies its registered Action%istener ob;ects by invoking their actionPerformed() methods. he general type is public abstract interface Action%istener e*tends ;ava.util.!vent%istener _ EE ` Public Instance :ethods public abstract void actionPerformed (Action!vent e)I

P "#t"#g:
o understand how A+ ?s painting API works, helps to know what triggers a paint operation in a windowing environment. In A+ , there are two kinds of painting operations, system#triggered painting, and application#triggered painting. $ystem#triggered Painting In a system#triggered painting operation, the system re"uests a component to render its contents, usually for one of the following reasons, he component is first made visible on the screen. he component is resi)ed. he component has damage that needs to be repaired. (.or e*ample, something that previously obscured the component has moved, and a previously obscured portion of the component has become e*posed). App#triggered Painting In an application#triggered painting operation, the component decides it needs to update its contents because its internal state has changed. (.or e*ample,. a button detects that a mouse button has been pressed and determines that it needs to paint a @depressed@ button visual).

T.e P "#t Met.o$:

0egardless of how a paint re"uest is triggered, the A+ uses a @callback@ mechanism for painting, and this mechanism is the same for both heavyweight and lightweight components. his means that a program should place the component?s rendering code inside a particular overridden method, and the toolkit will invoke this method when it?s time to paint. he method to be overridden is in ;ava.awt.Component, public void paint(Araphics g) +hen A+ invokes this method, the Araphics ob;ect parameter is pre#configured with the appropriate state for drawing on this particular component,

Mu*t" $"#g:
A thread e*ecutes a series of instructions. !very line of code that is e*ecuted is done so by a thread. $ome threads can run for the entire life of the applet, while others are alive for only a few milliseconds. he class ;ava.lang. hread is used to create and control threads. thread does not start running right away. hread.start() must be called to actually make the thread run. here are two ways to create a thread, !*tend the hread class. +ith this techni"ue the new class inherits from the class hread. he thread can start running in the class?s run method. Implement the 0unnable interface. his techni"ue is probably more common than e*tending the hread class. It is not necessary to define a new class to run the thread. If a thread is to start running in the applet, it must use the 0unnable interface. he applet cannot inherit from both the hread and Applet classes. An applet with the 0unnable interface must have a run() method for the thread to start. he hread class has seven constructors. All of them create a new thread. he constructors are the following, hread()

. o create a thread, a new instance of this class must be created. (owever, the

hread(0unnable) hread( hreadAroup) hread($tring) hread( hreadAroup,$tring) hread(0unnable,$tring) hread( hreadAroup,0unnable,$tring)

he constructors can use three possible parameters, $tring he name of the new thread is the parameter $tring. A thread can he new thread will belong to the group specified by the get its name by calling hread.get&ame(). hreadAroup 0unnable parameter hreadAroup. A hreadAroup can be used to organi)e a thread. he 0unnable parameter is an ob;ect that has implemented the 0unnable interface. he thread will start e*ecuting in the run() method of the 0unnable parameter when hread.start() has been called. here are many methods in the hread class. $ome of them, such as destroy(), don?t seem to have been implemented yet, and may never be. start() his method starts the thread. It starts e*ecuting in the run() method of its 0unnable target that was set when the constructor was called. his method can be called only once. suspend() resume() stop() his method suspends the e*ecution of the thread. It remains his method resumes the e*ecution of a suspended thread. It has suspended until resume() is called. no effect on a thread that is not suspended. his method stops and kills a running thread. Currently, the thread does not stop unless it is running. If it is suspended, it does not die until it starts running again. (owever, this may be fi*ed someday. sleep(int m)Esleep(int m,int n) n nanoseconds. he thread sleeps for m milliseconds, plus

!*ample, public class Infinite hread!*ample e*tends Applet implements 0unnable

_ hread my hreadI public void init() _ $ystem.out.println(@in init() ## starting thread.@)I my hreadV new hread(this)I my hread.start()I ` public void start() _ $ystem.out.println(@in start() ## resuming thread.@)I my hread.resume()I ` public void stop() _ $ystem.out.println(@in stop() ## suspending thread.@)I my hread.suspend()I ` public void destroy() _ $ystem.out.println(@in destroy() ## stoping thread.@)I my hread.resume()I my hread.stop()I ` public void run() _ int iVDI for(II) _ iUUI $ystem.out.println(@At @ U i U @ and counting6@)I

try _ my hread.sleep(5DDD)I ` catch (Interrupted!*ception e ) _` ` ` `

U#"t: 6 Ut"*"t+ P c9 ge/:

he final Fava package, ;ava.util, contains a collection of utility classes. he -tility Package of Fava consist of the following components, Collections framework %egacy collection classes !vent model 'ate and time facilities Internationali)ation :iscellaneous utility classes such as string tokeni)er, random#number generator and bit array 'escription of the utility classes of this package is as follows 'ata $tructure Classes, 'ata $tructure Classes are very useful classes for implementing standard computer science data structures, including /it$et, 'ictionary, (ashtable, $tack and 8ector. he !numeration interface of ;ava.util package is used to count through a set of values.


he 'ate class is used to manipulate calendar dates in a system#

independent fashion. $tring okeni)er, his $tring okeni)er class is used to convert a $tring of te*t into its tokens. Properties, he properties table contains keyEvalue pairs where both the

key and the value are $trings and the class is used by the $ystem class to implement $ystem properties. 1bserver and 1bservable, Classes that implement the 1bserver interface can @watch@ 1bservable ob;ects for state changes. +hen an 1bservable ob;ect changes it notifies all of its 1bservers of the change. 0andom#&umber Aenerator, he 0andom &umber Aenerator class is used to generate the random#numbers. !numeration, he !numeration interface defines a generic programming interface for iterating through a set of values.

I#1utCOut1ut P c9 ge/:
streams). :ost stream types support the methods of some basic interfaces and abstract classes, with few additions. he ;ava.nio package and its subpackages define IE1 in terms of buffers and channels. /uffers are data stores (similar to arrays) that can be read from or written to. Channels represent connections to entities capable of performing IE1 operations, including buffers, files, and sockets. model. byte streams. he package ; has two ma;or parts, character streams and he ; package provides specific support for network IE1, based around the use of sockets, with an underlying stream or channel#based he ; package defines IE1 in terms of streams. $treams are ordered se"uences of data that have a source (input streams) or destination (output

always) H bits.

Characters are 52#bit - .#52 characters, whereas bytes are (as he character streams are used for te*t#based IE1, while byte streams are used for data#based IE1. he byte streams are called input streams and output streams, and the character streams are called readers and writers he I1!*ception class is used by many methods in ; to signal e*ceptional conditions. $ome e*tended classes of I1!*ception signal specific problems.

0+te Stre !/:

he ; package defines abstract classes for basic byte input and output streams. All streams support the notion of being open or closed. Lou open a stream when you create it, and can read or write while it is open. Lou close a stream with its close method, defined in the Closeable interface. A stream class could define a finali)e method to release these resources during garbage collection Input$tream, he abstract class Input$tream declares methods to read bytes from a particular source. Input$tream is the superclass of most byte input streams in ; public abstract int read() throws I1!*ception public int read(byteXY buf, int offset, int count) throws I1!*ception public int read(byteXY buf) throws I1!*ception public long skip(long count) throws I1!*ception public int available() throws I1!*ception public void close() throws I1!*ception !*ample, import ;\I class Count/ytes

_ public static void main($tringXY args) throws I1!*ception _ Input$tream inI if (args.length VV D) in V $ystem.inI else in V new .ileInput$tream(argsXDY)I int total V DI while ( 6V #5) totalUUI $ystem.out.println(total U @ bytes@)I ` ` 1utput$tream, he abstract class 1utput$tream is analogous to Input$treamI it provides an abstraction for writing bytes to a destination. Its methods are, public abstract void write(int b) throws I1!*ception public void write(byteXY buf, int offset, int count) throws I1!*ception public void write(byteXY buf) throws I1!*ception public void flush() throws I1!*ception public void close() throws I1!*ception he implementation of 1utput$tream re"uires only that a subclass provide the single#byte variant of write because the other write methods are defined in terms of this one. he default implementations of flush and close will usually need to be overridden as appropriate for a particular streamRin particular, buffered streams may need to flush when closed. !*ample, import ;\I class ranslate/yte

_ public static void main($tringXY args) throws I1!*ception _ byte from V (byte) argsXDY.charAt(D)I byte to V (byte) argsX5Y.charAt(D)I int bI while ((b V $ 6V #5) $ystem.out.write(b VV from S to , b)I ` ` .or e*ample, if we invoked the program as ;ava ranslate/yte b / and entered the te*t abracadabra6, we would get the output a/racada/ra6 Character $treams, he abstract classes for reading and writing streams of characters are 0eader and +riter. !ach supports methods similar to those of its byte stream counterpartR Input$tream and 1utput$tream, respectively. 0eader has a read method that returns a char as the lowest 52 bits of an int. And, +riter has methods that write char arrays. he character streams were designed after the byte streams to provide full support for working with -nicode characters, and in the process the contracts of the classes were improved to make them easier to work with. 0eader, he abstract class 0eader provides a character stream analogous to the byte stream Input$tream and the methods of 0eader essentially mirror those of Input$tream, public int read() throws I1!*ception public abstract int read(charXY buf, int offset, int count) throws I1!*ception public int read(charXY buf) throws I1!*ception

public int read(;ava.nio.Char/uffer buf) throws I1!*ception public long skip(long count) throws I1!*ception public boolean ready() throws I1!*ception public abstract void close() throws I1!*ception he implementation of 0eader re"uires that a subclass provide an implementation of both the read method that reads into a char array, and the close method. here are a number of differences between 0eader and Input$tream. read methods are defined in terms of this method. In contrast the Input$tream class uses the single#byte read method as its fundamental reading method. !*ample, import ;\I class Count$pace _ public static void main($tringXY args) throws I1!*ception _ 0eader inI if (args.length VV D) in V new Input$tream0eader($ else in V new .ile0eader(argsXDY)I int chI int totalI int spaces V DI for (total V DI (ch V 6V #5I totalUU) _ if ( ch)) spacesUUI

+ith 0eader the fundamental reading method reads into a char array and the other

` $ystem.out.println(total U @ chars, @ U spaces U @ spaces@)I ` ` +riter, he abstract class +riter provides a stream analogous to 1utput$tream but designed for use with characters instead of bytes. he methods of +riter essentially mirror those of 1utput$tream, but add some other useful forms of write, public void write(int ch) throws I1!*ception public abstract void write(charXY buf, int offset, int count) throws I1!*ception public void write(charXY buf) throws I1!*ception public void write($tring str, int offset, int count) throws I1!*ception public void write($tring str) throws I1!*ception public abstract void flush() throws I1!*ception public abstract void close() throws I1!*ception $ubclasses of +riter must implement the array writing variant of write, the close method, and the flush method. +riter also implements the ;ava.lang.Appendable interface. he append(charc) method is e"uivalent to write(c)I the append methods that take a Char$e"uence are e"uivalent to passing the $tring representations of the Char$e"uence ob;ects to the write($tringstr) method. Input$tream0eader and 1utput$tream+riter, he conversion streams Input$tream0eader and 1utput$tream+riter translate between character and byte streams using either a specified character set encoding or the default encoding for the local system. An Input$tream0eader ob;ect is given a byte input stream as its source and produces the corresponding - .#52 characters. An 1utput$tream+riter ob;ect is given a byte output stream as its destination and produces encoded byte forms of the - .#52 characters written on it.

public Input$tream0eader(Input$tream in) public Input$tream0eader(Input$tream in, Charset c) public Input$tream0eader(Input$tream in, Charset'ecoder c) public Input$tream0eader(Input$tream in, $tring enc) throws

-nsupported!ncoding!*ception public 1utput$tream+riter(1utput$tream out) public 1utput$tream+riter(1utput$tream out, Charset c) public 1utput$tream+riter(1utput$tream out, Charset!ncoder c) public 1utput$tream+riter(1utput$tream out, $tring enc) throws -nsupported!ncoding!*ception he read methods of Input$tream0eader simply read bytes from their associated Input$tream and convert them to characters using the appropriate encoding for that stream. he write methods of 1utput$tream+riter take the supplied characters, convert them to bytes with the appropriate encoding, and write them to the associated 1utput$tream. he .ile0eader and .ile+riter classes are subclasses of these conversion streams. his helps you read and write local files correctly in a consistent, -nicode#savvy fashion using the local encoding.

I##er C* //:
here are four other types of classes, loosely known as inner classes, that can be defined in a Fava program. -sed correctly, inner classes are an elegant and powerful feature of the Fava language. hese four types of classes are summari)ed here, $tatic member classes A static member class is a class (or interface) defined as a static member of another class.

A static method is called a class method, so, by analogy, we could call this type of inner class a @class class,@ but this terminology would obviously be confusing. A static member class behaves much like an ordinary top#level class, e*cept that it can access the static members of the class that contains it. Interfaces can be defined as static members of classes.

:ember classes A member class is also defined as a member of an enclosing class, but is not declared with the static modifier. his type of inner class is analogous to an instance method or field. An instance of a member class is always associated with an instance of the enclosing class, and the code of a member class has access to all the fields and methods (both static and non#static) of its enclosing class. here are several features of Fava synta* that e*ist specifically to work with the enclosing instance of a member class. Interfaces can only be defined as static members of a class, not as non#static members. %ocal classes A local class is a class defined within a block of Fava code. %ike a local variable, a local class is visible only within that block. Although local classes are not member classes, they are still defined within an enclosing class, so they share many of the features of member classes. Additionally, however, a local class can access any final local variables or parameters that are accessible in the scope of the block that defines the class. Interfaces cannot be defined locally. Anonymous classes

An anonymous class is a kind of local class that has no nameI it combines the synta* for class definition with the synta* for ob;ect instantiation. +hile a local class definition is a Fava statement, an anonymous class definition (and instantiation) is a Fava e*pression, so it can appear as part of a larger e*pression, such as method invocation. Interfaces cannot be defined anonymously.

he most important feature of the inner class is that it allows us to turn things into ob;ects that we normally wouldn?t turn into ob;ects. hat allows our code to be even more ob;ect#oriented than it would be without inner classes

An inner class allows us to remove that logic and place it into its own class. $o from an ob;ect#oriented point of view, we?ve taken functionality out of where it doesn?t belong and have put it into its own class. 1b;ect#oriented design isn?t everyone?s thing, but luckily, inner classes provide more. .rom an organi)ational point of view, inner classes allow us to further organi)e our package structure through the use of namespaces. Instead of dumping everything in a flat package, classes can be further nested within classes. Inner classes have their disadvantages. .rom a maintenance point of view, ine*perienced Fava developers may find the inner class difficult to understand. he use of inner classes will also increase the total number of classes in your code.

J - D t b /e Co##ect"-"t+:
Fava 'atabase Connectivity or in short F'/C is a technology that enables the ;ava program to manipulate data stored into the database. F'/C is Fava application programming interface that allows the Fava programmers to access database management system from Fava code. It was developed by Fava$oft, a subsidiary of $un :icrosystems. F'/C is consists of four Components, he F'/C API, F'/C 'river :anager, he F'/C est $uite and F'/C#1'/C /ridge.

F'/C is an API specification developed by $un :icrosystems that defines a uniform interface for accessing various relational databases. F'/C is a core part of the Fava platform and is included in the standard F'4 distribution.

JD0C Dr"-er M # ger:

he F'/C 'river:anager class defines ob;ects which can connect Fava applications to a F'/C driver. 'river:anager has traditionally been the backbone of the F'/C architecture. Its main purpose is to provide a means of managing the different types of F'/C database driver. +hen opening a connection to a database it is the 'river:anager? s role to choose the most appropriate driver from the previously loaded drivers. A Fava program that uses the F'/C API loads the specified driver for a particular '/:$ before it actually connects to a database. he F'/C 'river:anager class then sends all F'/C API calls to the loaded driver. ypes of F'/C drivers, here are four types of F'/C drivers known as, F'/C#1'/C bridge plus 1'/C driver, also called ype 5. &ative#API, partly Fava driver, also called ype >. F'/C#&et, pure Fava driver, also called ype 7. &ative#protocol, pure Fava driver, also called ype 3. he method Class.for&ame($tring) is used to load the F'/C driver class. In F'/C 3.D, it?s no longer necessary to e*plicitly load F'/C drivers using Class.for&ame(). +hen a connection is needed, one of the 'river:anager.getConnection() methods is used to create a F'/C connection. he -0% used is dependent upon the particular F'/C driver. It will always begin with the @;dbc,@ protocol, but the rest is up to the particular vendor. 1nce a connection is established, a statement must be created.


import ;ava.s"l.\I public class :ys"lConnect _ public static void main($tringXY args) _ $ystem.out.println(@:y$B% Connect !*ample.@)I Connection conn V nullI $tring url V @;dbc,mys"l,EElocalhost,77D2E@I $tring db&ame V @;dbctutorial@I $tring driver V @com.mys"l.;dbc.'river@I $tring user&ame V @root@I $tring password V @root@I try _ Class.for&ame(driver).newInstance()I conn V 'river:anager.getConnection(urlUdb&ame,user&ame,password)I $ystem.out.println(@Connected to the database@)I conn.close()I $ystem.out.println(@'isconnected from database@)I ` catch (!*ception e) _ e.print$tack race()I ` ` `

$ervlets are Fava technology?s answer to CAI programming. hey are programs that run on a +eb server and build +eb pages.

Fava servlets are more efficient, easier to use, more powerful, more portable, and cheaper than traditional CAI and than many alternative CAI#like technologies. he $ervlet API, contained in the Fava package hierarchy ;ava*.servlet, defines the e*pected interactions of a +eb container and a servlet.

L"4ec+c*e o4 Ser-*et
he $ervlet lifecycle consists of the following steps, he $ervlet class is loaded by the container during start#up. he container calls the init() method. his method initiali)es the servlet

and must be called before the servlet can service any re"uests. In the entire life of a servlet, the init() method is called only once. After initiali)ation, the servlet can service client#re"uests. !ach re"uest is serviced in its own separate thread. he container calls the service() method of the servlet for every re"uest. he service() method determines the kind of re"uest being made and dispatches it to an appropriate method to handle the re"uest. he developer of the servlet must provide an implementation for these methods. If a re"uest for a method that is not implemented by the servlet is made, the method of the parent class is called, typically resulting in an error being returned to the re"uester. .inally, the container calls the destroy() method which takes the servlet out of service. he destroy() method like init() is called only once in the lifecycle of a $ervlet. $ervlet containers, A $ervlet container is a speciali)ed web server that supports $ervlet e*ecution. It combines the basic functionality of a web server with certain FavaE$ervlet specific optimi)ations and e*tensions = such as an integrated Fava runtime environment, and the ability to automatically translate specific -0%s into $ervlet re"uests. Individual $ervlets are registered with a $ervlet container, providing the container with information about what functionality they provide, and what -0% or other resource locator they will use to identify themselves.

he $ervlet container is then able to initiali)e the $ervlet as necessary and deliver re"uests to the $ervlet as they arrive. :any containers have the ability to dynamically add and remove $ervlets from the system, allowing new $ervlets to "uickly be deployed or removed without affecting other $ervlets running from the same container.

$ervlet containers are also referred to as web containers or web engines. +hen an ( P client (e.g. a browser) sends a re"uest, it is re"uired to supply a re"uest line (usually A! or P1$ ). If it wants to, it can also send a number of headers, all of which are optional e*cept for Content#%ength, which is re"uired only for P1$ re"uests. A response from a +eb server normally consists of a status line, one or more response headers, a blank line, and the document. $etting the ( P response headers often goes hand in hand with setting the status codes in the status line. he most general way to specify headers is by the set(eader method of (ttp$ervlet0esponse, which takes two strings, the header name and the header value. %ike setting the status codes, this must be done before any document content is sent. Cookies are small bits of te*tual information that a +eb server sends to a browser and that the browser returns unchanged when visiting the same +eb site or domain later. o send cookies to the client, a servlet would create one or more cookies with the appropriate names and values via new Cookie(name, value) o read incoming cookies, call re"uest.getCookies(), which returns an array of Cookie ob;ects. In most cases, you loop down this array until you find the one whose name (get&ame) matches the name you have in mind, then call get8alue on that Cookie to see the value associated with that name. here are a number of problems that arise from the fact that ( P is a @stateless@ protocol. In particular, when you are doing on#line shopping, it is a real annoyance that the +eb server can?t easily remember previous transactions. +hen you move from the page where you specify what you want to buy (hosted on the regular +eb server) to the page that takes your credit card number and

shipping address (hosted on the secure server that uses $$%), how does the server remember what you were buyingS problem. Cookies. -0% 0ewriting. (idden form fields. !*ample, import ;\I import ;ava*.servlet.\I import ;ava*.servlet.http.\I public class (ello+orld e*tends (ttp$ervlet _ public void doAet((ttp$ervlet0e"uest re"uest, (ttp$ervlet0esponse response) throws $ervlet!*ception, I1!*ception _ Print+riter out V response.get+riter()I out.println(@(ello +orld@)I ` ` here are three typical solutions to this

Re!ote Met.o$ I#-oc t"o#:

0emote :ethod Invocation (0:I) facilitates ob;ect function calls between Fava 8irtual :achines (F8:s). F8:s can be located on separate computers # yet one F8: can invoke methods belonging to an ob;ect stored in another F8:. :ethods can even pass ob;ects that a foreign virtual machine has never encountered before, allowing dynamic loading of new classes as re"uired. +riting your own 0:I services can be a little difficult at first. he first thing we need to do is to agree upon an interface, an interface is a description of the methods we will allow remote clients to invoke. An interface is a method which contains abstract methodsI these methods must be implemented

by another class. 1ur interface e*tends ;ava.rmi.0emote, which indicates that this is a remote service. And the ne*t step is to implement the interface. Implementing the interface is a little trickier. he real code we need to be concerned about is the constructor and main method. +e have to declare a default constructor, even when we don?t have any initiali)ation code for our service. throw a -nicast0emote1b;ect. 1ur implementation of the service also needs to have a main method. he main method will be responsible for creating an instance of our Power$ervice$erver, and registering (or binding) the service with the 0:I 0egistry. 1ur main method will also assign a security manager to the F8:, to prevent any nasty surprises from remotely loaded classes. In this case, a security manager isn?t really needed, but in more comple* systems where untrusted clients will be using the service, it is critical. +riting clients is the easy part # all a client has to do is call the registry to obtain a reference to the remote ob;ect, and call its methods. All the underlying network communication is hidden from view, which makes 0:I clients simple. 1ur client must first assign a security manager, and then obtain a reference to the service. &ote that the client receives an instance of the interface we defined earlier, and not the actual implementation. $ome behind#the#scenes work is going on, but this is completely transparent to the client. o identify a service, we specify an 0:I -0%. he -0% contains the hostname on which the service is located, and the logical name of the service. Fava 0:I is a useful mechanism for invoking methods of remote ob;ects. Fava 0:I allows one Fava 8irtual :achine to invoke methods of another, and to share any Fava ob;ect type, even if client or server has never come across that ob;ect type before. !*ample, 0eceive:essageInterface.;ava his is because our default constructor can from its parent constructor in ;ava.rmi.0emote!*ception,

import ;ava.rmi.\I public interface 0eceive:essageInterface e*tends 0emote _ void receive:essage($tring *) throws 0emote!*ceptionI `


import ;ava.rmi.\I import ;ava.rmi.registry.\I import ;ava.rmi.server.\I import ;\I

public class 0mi$erver e*tends ;ava.rmi.server.-nicast0emote1b;ect implements 0eceive:essageInterface

_ int thisPortI

$tring thisAddressI 0egistry registryI EE rmi registry for lookup the remote ob;ects.

EE his method is called from the remote client by the 0:I. EE his is the implementation of the a0eceive:essageInterfaceb. public void receive:essage($tring *) throws 0emote!*ception _ $ystem.out.println(*)I `

public 0mi$erver() throws 0emote!*ception _ try_

EE get the address of this host. thisAddressV (InetAddress.get%ocal(ost()).to$tring()I ` catch(!*ception e)_ throw new 0emote!*ception(@can?t get inet address.@)I ` thisPortV7>7>I EE this port(registry9s port) $ystem.out.println(@this addressV@UthisAddressU@,portV@UthisPort)I try_ EE create the registry and bind the name and ob;ect. registry V %ocate0egistry.create0egistry( thisPort )I registry.rebind(@rmi$erver@, this)I ` catch(0emote!*ception e)_ throw eI `

static public void main($tring argsXY) _ try_ 0mi$erver sVnew 0mi$erver()I ` catch (!*ception e) _ e.print$tack race()I $ystem.e*it(5)I ` ` `


import ;ava.rmi.\I import ;ava.rmi.registry.\I import ;\I public class 0miClient _ static public void main($tring argsXY) _ 0eceive:essageInterface rmi$erverI 0egistry registryI $tring serverAddressVargsXDYI $tring serverPortVargsX5YI $tring te*tVargsX>YI $ystem.out.println(@sending @Ute*tU@ to @UserverAddressU@,@UserverPort)I try_ EE get the aregistryb registryV%ocate0egistry.get0egistry( serverAddress, (new Integer(serverPort)).int8alue() )I EE look up the remote ob;ect rmi$erverV (0eceive:essageInterface)(registry.lookup(@rmi$erver@))I EE call the remote method rmi$erver.receive:essage(te*t)I ` catch(0emote!*ception e)_ e.print$tack race()I `

catch(&ot/ound!*ception e)_ e.print$tack race()I ` ` `

J - 0e #/:
A Fava /ean is a reusable software component that works with Fava. :ore specifically, a Fava /ean is a reusable software component that can be visually manipulated in builder tools. Practically, they are classes written in the Fava programming language conforming to a particular convention. hey are used to encapsulate many ob;ects into a single ob;ect (the bean), so that they can be passed around as a single bean ob;ect instead of as multiple individual ob;ects. In order to function as a Fava/ean class, an ob;ect class must obey certain conventions about method naming, construction, and behavior. he re"uired conventions are, he class must have a no#argument public constructor. his allows easy instantiation within editing and activation frameworks. he class properties must be accessible using get, set, and other methods (so#called accessor methods), following a standard naming convention. his allows easy automated inspection and updating of bean state within frameworks, many of which include custom editors for various types of properties. he class should be seriali)able. his allows applications and frameworks to reliably save, store, and restore the bean?s state in fashion that is independent of the 8: and platform. Properties are attributes of a /ean that are referenced by name. hese properties are usually read and written by calling methods on the /ean specifically created for that purpose.

he methods of a /ean are ;ust the Fava methods e*posed by the class that implements the /ean. hese methods represent the interface used to access and manipulate the component.

!vents are the mechanism used by one component to send notifications to another. 1ne component can register its interest in the events generated by another. +henever the event occurs, the interested component will be notified by having one of its methods invoked. Introspection is the process of e*posing the properties, methods, and events that a Fava/ean component supports. his process is used at run#time, as well as by a visual development tool at design#time. he default behavior of this process allows for the automatic introspection of any /ean. +hen you are using a visual development tool to assemble components into applications, you will be presented with some sort of user interface for customi)ing /ean attributes. hese attributes may affect the way the /ean his operates or the way it looks on the screen. It is necessary that /eans support a large variety of storage mechanisms. way, /eans can participate in the largest number of applications. he simplest

way to support persistence is to take advantage of Fava 1b;ect $eriali)ation. his is an automatic mechanism for saving and restoring the state of an ob;ect. here is no re"uirement that a /ean be visible at run#time. It is perfectly reasonable for a /ean to perform some function that does not re"uire it to present an interface to the userI the /ean may be controlling access to a specific device or data feed. he issue of multithreading is no different in Fava/eans than it is in conventional Fava programming. he Fava/eans architecture doesn?t introduce any new language constructs or classes to deal with threading. /eans are sub;ected to the same security model as standard Fava programs. Lou should assume that your /ean is running in an untrusted applet. Lou shouldn?t make any design decisions that re"uire your /ean to be run in a trusted environment.

!*ample, public class Person/ean implements ;$eriali)able _ private $tring nameI private boolean deceasedI EE &o#arg constructor (takes no arguments). public Person/ean() _ ` EE Property @name@ (note capitali)ation) readableEwritable public $tring get&ame() _ return this.nameI ` public void set&ame($tring name) _ V nameI ` EE Property @deceased@ EE 'ifferent synta* for a boolean field (is vs. get) public boolean is'eceased() _ return this.deceasedI ` public void set'eceased(boolean deceased) _ this.deceased V deceasedI ` `

EE estPerson/ean.;ava public class estPerson/ean _ public static void main($tringXY args) _ Person/ean person V new Person/ean()I person.set&ame(@/ob@)I person.set'eceased(false)I EE 1utput, @/ob XaliveY@ $ystem.out.print(person.get&ame())I $ystem.out.println('eceased() S @ XdeceasedY@ , @ XaliveY@)I ` `