Tải bản đầy đủ (.pdf) (1,157 trang)

Sams teach yourself programming with java in 24 hours 4th edition oct 2005 ISBN 0672328445

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (6.19 MB, 1,157 trang )

SAMSTeachYourselfProgrammingwith
Java™in24Hours,FOURTHEDITION
ByRogersCadenhead
...............................................
Publisher:Sams
PubDate:September30,2005
ISBN:0-672-32844-5
Pages:576

TableofContents|Index

IfyouhavebeenwantingtolearnJava,checkoutthenewlyrevisedfourtheditionof
thebest-sellerSamsTeachYourselfProgrammingwithJavain24Hours.Thisstepby-steptutorialwillteachyouhowtocreatesimpleJavaprogramsandapplets.
Comprisedof24one-hourlessons,thisneweditionfocusesonkeyprogramming
conceptsandessentialJavabasics,hasbeenimprovedbydozensofreadercomments,
andisreorganizedtobettercoverthelatestdevelopmentsinJava.Thebook's
coverageofcoreJavaprogrammingtopicshasalsobeenexpanded.Agreatstarting
pointforlearningJava,thisbookisalsoagreatprimertoreadingsamsTeachYourself
Javain21Days.


SAMSTeachYourselfProgrammingwith
Java™in24Hours,FOURTHEDITION
ByRogersCadenhead
...............................................
Publisher:Sams
PubDate:September30,2005
ISBN:0-672-32844-5
Pages:576

TableofContents|Index





Copyright



AbouttheAuthor



Acknowledgments



ReaderAcknowledgements



WeWanttoHearfromYou!



ReaderServices



Introduction




PartI.GettingStarted



Hour1.BecomingaProgrammer



ChoosingaLanguage



TellingtheComputerWhattoDo



HowProgramsWork



HowProgramsDon'tWork



NextStop:Java



Workshop:InstallingaJavaDevelopmentTool




Summary



Q&A



Quiz



Activities



Hour2.WritingYourFirstProgram



WhatYouNeedtoWritePrograms



CreatingtheSalutonProgram




StoringInformationinaVariable



SavingtheFinishedProduct



CompilingtheProgramintoaClassFile



FixingErrors



Workshop:RunningaJavaProgram



Summary




Q&A




Quiz



Activities



Hour3.VacationinginJava



FirstStop:SunMicrosystems



GoingtoSchoolwithJava



LunchinJavaWorld



WatchingtheSkiesatNASA



GettingDowntoBusiness




StoppingbyGamelantoAskDirections



Workshop:VenturingintoAnotherWorld



Summary



Q&A



Quiz



Activities



Hour4.UnderstandingHowJavaProgramsWork




CreatinganApplication



SendingArgumentstoApplications



AppletBasics



SendingParameterstoApplets



Workshop:ViewingtheCodeUsedtoRunApplets



Summary



Q&A



Quiz




Activities




PartII.LearningtheBasicsofProgramming
Hour5.StoringandChangingInformationinaProgram



StatementsandExpressions



AssigningVariableTypes



NamingYourVariables



StoringInformationinVariables



Workshop:UsingExpressions




AllaboutOperators



Summary



Q&A



Quiz




Activities
Hour6.UsingStringstoCommunicate



StoringTextinStrings



DisplayingStringsinPrograms




UsingSpecialCharactersinStrings



PastingStringsTogether



UsingOtherVariableswithStrings



AdvancedStringHandling



Workshop:PresentingCredits




Summary



Q&A




Quiz




Activities
Hour7.UsingConditionalTeststoMakeDecisions



TestingaCondition



ifStatements



if-elseStatements



switchStatements



TheConditionalOperator




Workshop:WatchingtheClock



Summary



Q&A



Quiz



Activities



Hour8.RepeatinganActionwithLoops



forLoops



whileLoops




do-whileLoops



ExitingaLoop



NamingaLoop



Workshop:TeachingYourComputeraLesson



Summary



Q&A



Quiz






Activities
PartIII.WORKINGWITHINFORMATIONINNEWWAYS
Hour9.StoringInformationwithArrays



CreatingArrays



UsingArrays



MultidimensionalArrays



SortinganArray



Workshop:ArrayofPrizes,Indeed



Summary




Q&A



Quiz



Activities



Hour10.CreatingYourFirstObject



HowObject-OrientedProgrammingWorks



ObjectsinAction



WhatObjectsAre




UnderstandingInheritance



BuildinganInheritanceHierarchy



ConvertingObjectsandSimpleVariables




Workshop:CreatinganObject



Summary



Q&A



Quiz





Activities
Hour11.DescribingWhatYourObjectIsLike



CreatingVariables



CreatingClassVariables



CreatingBehaviorwithMethods



PuttingOneClassinsideAnother



UsingthethisKeyword



Workshop:UsingClassMethodsandVariables




Summary



Q&A



Quiz



Activities



Hour12.MakingtheMostofExistingObjects



ThePowerofInheritance



EstablishingInheritance



WorkingwithExistingObjects




StoringObjectsoftheSameClassinVectors



Workshop:CreatingaSubclass



Summary



Q&A



Quiz



Activities




PartIV.ProgrammingaGraphicalUserInterface
Hour13.BuildingaSimpleUserInterface




SwingandtheAbstractWindowingToolkit



UsingComponents



Workshop:CreatingYourOwnComponent



Summary



Q&A



Quiz




Activities
Hour14.LayingOutaUserInterface




UsingLayoutManagers



Workshop:LayingOutanApplication



Summary



Q&A



Quiz



Activities



Hour15.RespondingtoUserInput




GettingYourProgramstoListen




SettingUpComponentstoBeHeard



HandlingUserEvents



Workshop:ALittleLottoMadness



Summary



Q&A



Quiz



Activities




Hour16.BuildingaComplexUserInterface



ScrollPanes



Sliders



ChangeListeners



Menus



Workshop:UsingImageIconsandToolbars



Summary




Q&A



Quiz



Activities




PartV.CreatingMultimediaPrograms
Hour17.CreatingInteractiveWebPrograms



StandardAppletMethods



PuttinganAppletonaWebPage



ASampleApplet




TheJavaPlug-in



SendingParametersfromaWebPage



ReceivingParametersintheApplet



Workshop:HandlingParametersinanApplet



JavaWebStart



UsingJavaWebStart



Summary



Q&A




Quiz



Activities



Hour18.HandlingErrorsinaProgram



Exceptions



Assertions



Workshop:ThrowingandCatchingExceptions



Summary




Q&A



Quiz



Activities



Hour19.CreatingaThreadedProgram



Threads



WorkingwithThreads



Startingwithinit()





CatchingErrorsasYouSetUpURLs



HandlingScreenUpdatesinthepaint()Method



StartingtheThread



HandlingMouseClicks



Workshop:RevolvingLinks



Summary



Q&A



Quiz




Activities



Hour20.ReadingandWritingFiles



Streams



WritingDatatoaStream



ReadingandWritingConfigurationProperties



Workshop:WritingBytestoanMP3File



Summary




Q&A



Quiz





Activities
PartVI.CreatingMultimediaPrograms
Hour21.ReadingandWritingXMLData



CreatinganXMLFile



ReadinganXMLFile



Workshop:ReadingRSSSyndicationFeeds



Summary




Q&A



Quiz



Activities



Hour22.UsingFontsandColor



UsingtheFontClass



UsingtheColorClass



OtherWaystoChooseColors




Workshop:DisplayingaDangerMessage



Summary



Q&A



Quiz




Activities
Hour23.WorkingwithGraphics



UsingGraphics



DrawingLinesandShapes




Workshop:BakingaPieGraph



Summary



Q&A



Quiz





Activities
Hour24.CreatingAnimation



AnimatingaSequenceofImages



SendingParameterstotheApplet




Workshop:FollowtheBouncingBall



Summary



Q&A



Quiz



Activities




PartVII.Bonus…
Hour25.CreatingWebServiceswithXML-RPC



WorkingwithApacheXML-RPC




CreatinganXML-RPCHandler



CreatinganXML-RPCServer



CreatinganXML-RPCClient



Workshop:EnhancingtheLottoMadnessApplication



Summary



Q&A



Quiz






Activities
PartVIII.Appendixes
AppendixA.UsingtheJavaDevelopmentKit



ChoosingaJavaDevelopmentTool



ConfiguringtheJavaDevelopmentKit



UsingaTextEditor



CreatingaSampleProgram



SettingUptheCLASSPATHVariable



AppendixB.ProgrammingwiththeJavaDevelopmentKit




AnOverviewoftheJDK



ThejavaInterpreter



ThejavacCompiler



TheappletviewerBrowser



ThejavadocDocumentationTool



ThejarJavaFileArchivalTool



ThejdbDebugger



UsingSystemProperties




Summary




Q&A
AppendixC.UsingtheNetBeansIntegratedDevelopmentEnvironment



ChoosingaJavaDevelopmentTool



CreatingaSampleProgram



AppendixD.WheretoGofromHere:JavaResources




OtherBookstoConsider




Sun'sOfficialJavaSite



OtherJavaWebsites



JavaNewsgroups



InternetRelayChat



JobOpportunities





AppendixE.ThisBook'sWebsite
SunMicrosystems,Inc.BinaryCodeLicenseAgreement



JAVA™DEVELOPMENTTOOLSJAXP.JARANDPARSER.JARARCHIVEFILESFROMJAVA
APIFORXMLPARSING,VERSION1.0SUPPLEMENTALLICENSETERMS




JAVAHELP™VERSION2.0SUPPLEMENTALLICENSETERMS



JAVA™DEVELOPMENTTOOLSJAVACCOMPILERSUPPLEMENTALLICENSETERMS







JAVA™INTERFACECLASSESJ2EE™DEPLOYMENTSPECIFICATIONINTERFACECLASSES
1.1SUPPLEMENTALLICENSETERMS



JAVA2,ENTERPRISEEDITION(J2EE™)MANAGEMENT,VERSION1.0JAVA™INTERFACE
CLASSESSUPPLEMENTALLICENSETERMS



JAVA™INTERFACECLASSESENTERPRISEJAVABEANS™,VERSION2.0,INTERFACE
CLASSESSUPPLEMENTALLICENSETERMS



JAVA™OPTIONALPACKAGEJMX™,VERSION1.2SUPPLEMENTALLICENSETERMS




J2EEeditor.jarSUPPLEMENTALLICENSETERMS



resolver-1_1_nb.jarBasedonSun'sXMLResolver1.0SoftwareLicenseAgreement



What'sontheCD-ROM



WindowsInstallationInstructions



UNIXandUNIX-likeInstallationInstructions



Index


Copyright
Copyright©2006bySamsPublishing
Allrightsreserved.Nopartofthisbookshallbereproduced,storedinaretrieval
system,ortransmittedbyanymeans,electronic,mechanical,photocopying,

recording,orotherwise,withoutwrittenpermissionfromthepublisher.No
patentliabilityisassumedwithrespecttotheuseoftheinformationcontained
herein.Althougheveryprecautionhasbeentakeninthepreparationofthisbook,
thepublisherandauthorassumenoresponsibilityforerrorsoromissions.Noris
anyliabilityassumedfordamagesresultingfromtheuseoftheinformation
containedherein.
LibraryofCongressCatalogCardNumber:2005928293
PrintedintheUnitedStatesofAmerica
FirstPrinting:October2005
080706054321

Trademarks
Alltermsmentionedinthisbookthatareknowntobetrademarksorservice
markshavebeenappropriatelycapitalized.SamsPublishingcannotattesttothe
accuracyofthisinformation.Useofaterminthisbookshouldnotberegarded
asaffectingthevalidityofanytrademarkorservicemark.

WarningandDisclaimer
Everyefforthasbeenmadetomakethisbookascompleteandasaccurateas
possible,butnowarrantyorfitnessisimplied.Theinformationprovidedisonan
"asis"basis.Theauthorandthepublishershallhaveneitherliabilitynor
responsibilitytoanypersonorentitywithrespecttoanylossordamagesarising


fromtheinformationcontainedinthisbookorfromtheuseoftheCDor
programsaccompanyingit.

BulkSales
SamsPublishingoffersexcellentdiscountsonthisbookwhenorderedin
quantityforbulkpurchasesorspecialsales.Formoreinformation,please

contact
U.S.CorporateandGovernmentSales
1-800-382-3419

ForsalesoutsideoftheU.S.,pleasecontact
InternationalSales


Credits
SeniorEditor
ScottMeyers
ManagingEditor
CharlotteClapp
ProjectEditor
AndyBeaster
Indexer
ChrisBarrick
Proofreader


PaulaLowell
TechnicalEditor
JohnPurdum
PublishingCoordinator
VanessaEvans
MultimediaDeveloper
DanScherf
BookDesigner
GaryAdair
PageLayout

ToiDavis
NonieRatcliff

Dedication
TomywifeM.C.Moeweforthefirst18yearsofhappilyeverafter.Maythis
booksellconsiderablybetterthanthefirstbookIdedicatedtoyoubackin1996,
SamsTeachYourselfSunSoftJavaWorkshopin21Days.I'mnotimplyingthat
yourdedicationhadanythingtodowiththesalesperformanceofthattitle,butif
thisbooksuffersasimilarfate,Imighthavesecondthoughtsaboutnot
dedicatingittomymother.ButIdigress.SomeonewaslookingoutformewhenI
stumbleddrunkenlyintotheloveofmylifeatathree-kegtogabacchanaliaatthe
UniversityofTexas-Arlingtonin1987.Iwillalwayscherishthefirstmoment
whenyoustaredatmethroughthickbeergogglesanddecidedIwasn'tasweird
lookingasyouoriginallysuspected.Rogers


AbouttheAuthor
RogersCadenheadisawriter,webapplicationdeveloper,andthemost
valuableplayerinanNBAplayoffgame[*].Hehaswritten20booksonInternetrelatedtopics,includingSamsTeachYourselfJava2in21Days,FourthEdition,
SamsTeachYourselfMicrosoftFrontPage2003in24Hours,andRadio
UserLandKickStart.Hemaintainsthisbook'sofficialwebsiteat
.
[*]CadenheadattendedGame6ofthe1988NBAWesternConferenceFinalsatReunionArenain
Dallas.TheDallasMavericksbeattheLosAngelesLakers105-103toforceaseventhgameofthe
series.CBSSportsgavehalftheMVPawardtoMaverickspowerforwardMarkAguirrefor23
pointsand13rebounds,andhalftotheselloutcrowdof17,007forshoutingawholelotinloud
voicesandmakingenthusiastichandgestures.

Cadenhead'sstatisticsinthegame:


PLAYERMINFGM-FGAFTM-FTAOFF-DEF-TOTASTPFSTTOPTSBEE
TOBATHROOM

=================================================
=================

CADENHEAD00-00-0000000000
3


Acknowledgments
TothefolksatSamsespeciallyMarkTaber,ScottMeyers,JohnPurdum,and
AndyBeaster.Noauthorcanproduceabooklikethisonhisown,regardlessof
whatmyagenttoldSamsduringcontractnegotiations.Theirexcellentworkwill
givemeplentytotakecreditforlateron.
ToLauraLewinattheStudioBagency,whoworkedhardonmybehalfin
regardtothistitleandmanyothers.
Tomywife,Mary,andmysons,Max,Eli,andSam.Althoughourfamilyhasnot
fulfilledmydreamofbecomingahigh-wiretrapezeteamliketheFlying
Wallendas,I'mtheworld'sproudesthusbandinanon-acrobaticfamily.


ReaderAcknowledgements
I'dalsoliketothankreaderswhohavesenthelpfulcommentsaboutcorrections,
typos,andsuggestedimprovementstothebook.ThelistincludesBrian
Converse,PhilipB.CoppIII,WallaceEdwards,M.B.Ellis,KevinFoad,Adam
Grigsby,MarkHardy,KellyHoke,DonovanKelorii,RusselLoski,Jason
Saredy,MikeSavage,PeterSchrier,GeneWines,JimYates,andotherswho
shallremainnamelessbecausetheyhelpedmeimprovethebookbeforeIstarted
thislist.



WeWanttoHearfromYou!
Asthereaderofthisbook,youareourmostimportantcriticandcommentator.
Wevalueyouropinionandwanttoknowwhatwe'redoingright,whatwecould
dobetter,whatareasyou'dliketoseeuspublishin,andanyotherwordsof
wisdomyou'rewillingtopassourway.
Youcanemailorwritemedirectlytoletmeknowwhatyoudidordidn'tlike
aboutthisbookaswellaswhatwecandotomakeourbooksstronger.
PleasenotethatIcannothelpyouwithtechnicalproblemsrelatedtothetopicof
thisbook,andthatduetothehighvolumeofmailIreceive,Imightnotbeable
toreplytoeverymessage.
Whenyouwrite,pleasebesuretoincludethisbook'stitleandauthoraswellas
yournameandphoneoremailaddress.Iwillcarefullyreviewyourcomments
andsharethemwiththeauthorandeditorswhoworkedonthebook.

Email:



Mail:

MarkTaber
AssociatePublisher
SamsPublishing
201West103rdStreet
Indianapolis,IN46290USA


ReaderServices

FormoreinformationaboutthisbookorothersfromSamsPublishing,visitour
websiteatwww.samspublishing.com.TypetheISBN(excludinghyphens)orthe
titleofthebookintheSearchboxtofindthebookyou'relookingfor.


Introduction
Astheauthorofcomputerbooks,Ispendalotoftimelurkinginthecomputer
sectionofbookstores,observingthebehaviorofshoppersbrowsingthroughthe
booksasiftheywerehominidjawbonesandIwasapaleontologist.
Becauseofmyresearch,I'velearnedthatifyouhavepickedupthisbookand
turnedtotheintroduction,Ionlyhaveabout12moresecondsbeforeyouputit
downandheadtothecoffeebarforadoubletalllattedecafskimwithtwoshots
ofvanillaholdthewhip.
SoI'llkeepthisbrief:ComputerprogrammingwithJavaisaloteasierthanit
looks.I'mnotsupposedtotellyouthat,becausetherearethousandsof
programmerswhohaveusedtheirJavaskillstogethigh-payingjobsinsoftware
development,webapplicationprogramming,ande-commerce.Thelastthing
anyofthemwantisfortheirbossestoknowthatanyonewhohaspersistence
andalittlefreetimecanlearnthislanguage,themostpopularprogramming
languageinusetoday.Byworkingyourwaythrougheachoftheone-hour
tutorialsinSamsTeachYourselfProgrammingwithJavain24Hours,Fourth
Edition,you'llbeabletolearnJavaprogrammingquickly.
Anyonecanlearnhowtowritecomputerprogramseveniftheycan'tprograma
VCR.Javaisoneofthebestprogramminglanguagestolearnbecauseit'sa
useful,powerful,moderntechnologythat'sembracedbythousandsof
programmersaroundtheworld.
Thisbookisaimedatnon-programmers,newprogrammerswhohatedlearning
thesubject,andexperiencedprogrammerswhowanttoquicklygetuptospeed
withJava.ItusesJava2version5,thecurrentversionofthelanguage.
JavaistheTigerWoodsofprogramminglanguagesbecauseofthethingsit

makespossible.Youcancreateprogramsthatfeatureagraphicaluserinterface,
designsoftwarethatmakesthemostoftheInternet,readXMLdata,add
animationtoWorldWideWebpages,andmore.
ThisbookteachesJavaprogrammingfromthegroundup.Itintroducesthe


conceptsinEnglishinsteadofjargon,withplentyofstep-by-stepexamplesof
workingprogramsyouwillcreate.Spend24hourswiththisbookandyou'llbe
writingyourownJavaprograms,confidentinyourabilitytousethelanguage
andlearnmoreaboutit.Youalsowillhaveskillsthatarebecomingincreasingly
importantsuchasnetworkcomputing,graphicaluserinterfacedesign,and
object-orientedprogramming.
Thesetermsmightnotmeanmuchtoyounow.Infact,they'reprobablythekind
ofthingthatmakesprogrammingseemlikeasecretritualforaweirdgroupof
humanswhohavealanguageoftheirown.However,ifyoucanuseacomputer
tocreateanattractiveresume,balanceyourcheckbook,orcreateahomepage,
youcanwritecomputerprogramsbyreadingSamsTeachYourselfProgramming
withJavain24Hours,FourthEdition.


BytheWay
Atthispoint,ifyouwouldratherhavecoffeethanJava,pleasereshelvethis
bookwiththefrontcoverfacingoutwardonanendcapwithaccesstoalotof
thestore'sfoottraffic.


PartI:GettingStarted


HOUR1BecomingaProgrammer




HOUR2WritingYourFirstProgram



HOUR3VacationinginJava



HOUR4UnderstandingHowJavaProgramsWork


Hour1.BecomingaProgrammer
Computerprogrammingisinsanelydifficult.Itrequiresafour-yeardegreein
computerscience,thousandsofdollarsincomputerhardwareandsoftware,a
keenanalyticalintellect,thepatienceofJob,andastronglikingforcaffeinated
drinks.Ifyou'reaprogrammingnovice,thisisprobablywhatyou'veheardabout
computerprogramming.Asidefromthepartaboutcaffeine,alloftherumorsare
greatlyexaggerated.
Programmingiseasierthanmostpeoplethink,althoughthereareseveralreasons
whyyoumightbelieveotherwise:
Computerprogrammershavebeentellingpeopleforyearsthat
programmingishard.Thisbeliefmakesiteasierforustofindhigh-paying
jobsandgivesusmoreleewaytogoofoffduringbusinesshours.
Computerprogrammingmanualsareoftenwritteninalanguagethatonlya
Scrabbleplayercouldappreciate.StrangeacronymslikeOOP,RAD,COM,
andMUMPSareusedfrequentlyalongwithnewlyinventedjargonlike
instantiation,bytecode,andmakefile.

Manycomputerprogramminglanguageshavebeenavailableonlywith
softwarepackagescosting$200ormore,whichisalotofcabbage.
BecauseofthegrowthoftheInternetandotherfactors,thisisagreattimeto
learnprogramming.Usefulprogrammingtoolsarebeingmadeavailableatlow
cost(ornocost),oftenasdownloadsfromWorldWideWebsites.Thousandsof
programmersaredistributingtheirworkunder"opensource"licensessopeople
canexaminehowtheprogramswerewritten,correcterrors,andaddtheirown
improvements.
Thegoalofthisbookistoteachprogrammingtothepersonwhohasnevertried
toprogrambefore,orthepersonwhotriedprogrammingbuthateditwithan
intensepassion.TheEnglishlanguagewillbeusedasmuchaspossibleinstead
ofjargonandobscureacronyms,andallnewprogrammingtermswillbe


thoroughlyexplainedastheyareintroduced.
IfI'vesucceeded,youwillfinishSamsTeachYourselfProgrammingwithJavain
24Hourswithenoughprogrammingskilltobeadangertoyourselfandothers.
You'llbeabletowriteprograms,diveintootherprogrammingbookswithmore
confidence,andlearnprogramminglanguagesmoreeasily.Youalsowillhave
developedskillswithJava,themostinnovativeprogramminglanguagetobe
introducedinyears.
Thefirsthourofthisbookprovidessomeintroductorymaterialabout
programmingandgivesyouinstructionsonhowtosetupyourcomputersoyou
canwriteJavaprograms.Thefollowingtopicswillbecovered:
Choosingwhichprogramminglanguagetolearnfirst
LearningwhatJavais
Usingprogramstobossyourcomputeraround
Discoveringhowprogramswork
Fixingprogramerrors(calledbugs)
AcquiringaJavadevelopmenttool

Gettingreadytowriteprograms


ChoosingaLanguage
Asyoumighthavesurmisedatthispoint,computerprogrammingisnotashard
asit'scrackeduptobe.Ifyou'recomfortableenoughwithacomputertoprepare
anice-lookingresume,balanceacheckbookwithsoftwaresuchasIntuit
Quicken,orcreateyourownhomepageontheWeb,youcanwriteprograms.
Thekeytolearninghowtoprogramistostartwiththerightlanguage.The
programminglanguageyouchooseoftendependsonthetasksyouwantthe
computertoaccomplish.Eachlanguagehasthingsitiswell-suitedforaswellas
thingsthataredifficultperhapsimpossibletodowiththelanguage.Forexample,
manypeopleusesomeformoftheBASIClanguagewhentheyarelearninghow
toprogrambecauseBASICwascreatedwithbeginnersinmind.


BytheWay
TheBASIClanguagewasinventedinthe1960stobeeasyforstudentsand
beginnerstolearn(theBinBASICstandsforBeginner's).Thedownsideto
usingsomeformofBASICisthatit'seasytofallintosloppyprogramming
habitswiththelanguage.Thosehabitscanmakeitmuchmoredifficulttowrite
complexprogramsandimprovethemlater.

MicrosoftVisualBasiccombinestheeaseofBASICwithsomepowerful
featurestoaidinthedesignofWindowssoftware.(VBScript,whichisshortfor
VisualBasicScript,offersthesimplicityofBASICforsmallprogramsthatrun
inconjunctionwithWorldWideWebpages.)VisualBasichasbeenusedtowrite
thousandsofsophisticatedprogramsforcommercial,business,andpersonaluse.
However,VisualBasicprogramscanbeslowerthanWindowsprogramswritten
inotherlanguagessuchasBorlandC++.Thisdifferenceisespeciallynoticeable

inprogramsthatusealotofgraphicsgames,screensavers,andthelike.
ThisbookcoverstheJavaprogramminglanguage,whichwasdevelopedbySun
Microsystems.ThoughJavaismoredifficulttolearnthanalanguagesuchas
VisualBasic,itisagoodstartingplaceforseveralreasons.Oneadvantageof
learningJavaisthatyoucanuseitontheWorldWideWeb.Ifyou'rean
experiencedwebsurfer,youhaveseennumerousJavaprogramsinaction.They
canbeusedtocreatechatrooms,playgames,andhelpinotherinteractive
efforts.
AnotherimportantadvantageisthatJavarequiresanorganizedapproachfor
gettingprogramstowork.Thelanguageisveryparticularabouttheway
programsmustbewritten,anditbalksifprogrammersdonotfollowallofits
rules.
WhenyoustartwritingJavaprograms,youmightnotseethelanguage'schoosy
behaviorasanadvantage.You'llwriteaprogramandhaveseveralerrorstofix
beforetheprogramisfinished.Someofyourfixesmightnotbecorrect,andthey


×