2023年Java英文面试题经典_第1页
2023年Java英文面试题经典_第2页
2023年Java英文面试题经典_第3页
2023年Java英文面试题经典_第4页
2023年Java英文面试题经典_第5页
已阅读5页,还剩26页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

英文Java面试题Question:Whatistransientvariable?Answer:Transientvariablecan'tbeserialize.ForexampleifavariableisdeclaredastransientinaSerializableclassandtheclassiswrittentoanObjectStream,thevalueofthevariablecan'tbewrittentothestreaminsteadwhentheclassisretrievedfromtheObjectStreamthevalueofthevariablebecomesnull.Question:NamethecontainerswhichusesBorderLayoutastheirdefaultlayout?Answer:ContainerswhichusesBorderLayoutastheirdefaultare:window,FrameandDialogclasses.Question:WhatdoyouunderstandbySynchronization?Answer:Synchronizationisaprocessofcontrollingtheaccessofsharedresourcesbythemultiplethreadsinsuchamannerthatonlyonethreadcanaccessoneresourceatatime.Innonsynchronizedmultithreadedapplication,itispossibleforonethreadtomodifyasharedobjectwhileanotherthreadisintheprocessofusingorupdatingtheobject'svalue.Synchronizationpreventssuchtypeofdatacorruption.E.g.Synchronizingafunction:publicsynchronizedvoidMethod1(){//Appropriatemethod-relatedcode.}E.g.Synchronizingablockofcodeinsideafunction:publicmyFunction(){synchronized(this){//Synchronizedcodehere.}}Question:WhatisCollectionAPI?Answer:TheCollectionAPIisasetofclassesandinterfacesthatsupportoperationoncollectionsofobjects.Theseclassesandinterfacesaremoreflexible,morepowerful,andmoreregularthanthevectors,arrays,andhashtablesifeffectivelyreplaces.Exampleofclasses:HashSet,HashMap,ArrayList,LinkedList,TreeSetandTreeMap.Exampleofinterfaces:Collection,Set,ListandMap.Question:IsIteratoraClassorInterface?Whatisitsuse?Answer:IteratorisaninterfacewhichisusedtostepthroughtheelementsofaCollection.Question:Whatissimilarities/differencebetweenanAbstractclassandInterface?Answer:Differencesareasfollows:Interfacesprovideaformofmultipleinheritance.Aclasscanextendonlyoneotherclass.Interfacesarelimitedtopublicmethodsandconstantswithnoimplementation.Abstractclassescanhaveapartialimplementation,protectedparts,staticmethods,etc.AClassmayimplementseveralinterfaces.Butincaseofabstractclass,aclassmayextendonlyoneabstractclass.Interfacesareslowasitrequiresextraindirectiontofindcorrespondingmethodintheactualclass.Abstractclassesarefast.Similarities:NeitherAbstractclassesorInterfacecanbeinstantiated.Question:HowtodefineanAbstractclass?Answer:AclasscontainingabstractmethodiscalledAbstractclass.AnAbstractclasscan'tbeinstantiated.ExampleofAbstractclass:abstractclasstestAbstractClass{protectedStringmyString;publicStringgetMyString(){returnmyString;}publicabstractstringanyAbstractFunction();}Question:HowtodefineanInterface?Answer:InJavaInterfacedefinesthemethodsbutdoesnotimplementthem.Interfacecanincludeconstants.AclassthatimplementstheinterfacesisboundtoimplementallthemethodsdefinedinInterface.EmapleofInterface:publicinterfacesampleInterface{publicvoidfunctionOne();publiclongCONSTANT_ONE=1000;}Question:ExplaintheuserdefinedExceptions?Answer:UserdefinedExceptionsaretheseparateExceptionclassesdefinedbytheuserforspecificpurposed.Anuserdefinedcancreatedbysimplysub-classingittotheExceptionclass.Thisallowscustomexceptionstobegenerated(usingthrow)andcaughtinthesamewayasnormalexceptions.Example:classmyCustomExceptionextendsException{//Theclasssimplyhastoexisttobeanexception}Question:ExplainthenewFeaturesofJDBC2.0CoreAPI?Answer:TheJDBC2.0APIincludesthecompleteJDBCAPI,whichincludesbothcoreandOptionalPackageAPI,andprovidesinductrial-strengthdatabasecomputingcapabilities.NewFeaturesinJDBC2.0CoreAPI:Scrollableresultsets-usingnewmethodsintheResultSetinterfaceallowsprogrammaticallymovethetoparticularrowortoapositionrelativetoitscurrentpositionJDBC2.0CoreAPIprovidestheBatchUpdatesfunctionalitytothejavaapplications.JavaapplicationscannowusetheResultSet.updateXXXmethods.Newdatatypes-interfacesmappingtheSQL3datatypesCustommappingofuser-definedtypes(UTDs)Miscellaneousfeatures,includingperformancehints,theuseofcharacterstreams,fullprecisionforjava.math.BigDecimalvalues,additionalsecurity,andsupportfortimezonesindate,time,andtimestampvalues.Question:Explaingarbagecollection?Answer:GarbagecollectionisoneofthemostimportantfeatureofJava.GarbagecollectionisalsocalledautomaticmemorymanagementasJVMautomaticallyremovestheunusedvariables/objects(valueisnull)fromthememory.Userprogramcann'tdirectlyfreetheobjectfrommemory,insteaditisthejobofthegarbagecollectortoautomaticallyfreetheobjectsthatarenolongerreferencedbyaprogram.Everyclassinheritsfinalize()methodfromjava.lang.Object,thefinalize()methodiscalledbygarbagecollectorwhenitdeterminesnomorereferencestotheobjectexists.InJava,itisgoodideatoexplicitlyassignnullintoavariablewhennomoreinuse.IJavaoncallingSystem.gc()andRuntime.gc(),JVMtriestorecycletheunusedobjects,butthereisnoguaranteewhenalltheobjectswillgarbagecollected.Question:Howyoucanforcethegarbagecollection?Answer:Garbagecollectionautomaticprocessandcan'tbeforced.Question:WhatisOOPS?Answer:OOPisthecommonabbreviationforObject-OrientedProgramming.Question:DescribetheprinciplesofOOPS.Answer:TherearethreemainprincipalsofoopswhicharecalledPolymorphism,InheritanceandEncapsulation.Question:ExplaintheEncapsulationprinciple.Answer:Encapsulationisaprocessofbindingorwrappingthedataandthecodesthatoperatesonthedataintoasingleentity.Thiskeepsthedatasafefromoutsideinterfaceandmisuse.Onewaytothinkaboutencapsulationisasaprotectivewrapperthatpreventscodeanddatafrombeingarbitrarilyaccessedbyothercodedefinedoutsidethewrapper.Question:ExplaintheInheritanceprinciple.Answer:Inheritanceistheprocessbywhichoneobjectacquiresthepropertiesofanotherobject.Question:ExplainthePolymorphismprinciple.Answer:ThemeaningofPolymorphismissomethinglikeonenamemanyforms.Polymorphismenablesoneentitytobeusedasasgeneralcategoryfordifferenttypesofactions.Thespecificactionisdeterminedbytheexactnatureofthesituation.Theconceptofpolymorphismcanbeexplainedas"oneinterface,multiplemethods".Question:ExplainthedifferentformsofPolymorphism.Answer:Fromapracticalprogrammingviewpoint,polymorphismexistsinthreedistinctformsinJava:MethodoverloadingMethodoverridingthroughinheritanceMethodoverridingthroughtheJavainterfaceQuestion:WhatareAccessSpecifiersavailableinJava?Answer:Accessspecifiersarekeywordsthatdeterminesthetypeofaccesstothememberofaclass.Theseare:PublicProtectedPrivateDefaultsQuestion:DescribethewrapperclassesinJava.Answer:Wrapperclassiswrapperaroundaprimitivedatatype.Aninstanceofawrapperclasscontains,orwraps,aprimitivevalueofthecorrespondingtype.Followingtableliststheprimitivetypesandthecorrespondingwrapperclasses:PrimitiveWrapperbooleanjava.lang.Booleanbytejava.lang.Bytecharjava.lang.Characterdoublejava.lang.Doublefloatjava.lang.Floatintjava.lang.Integerlongjava.lang.Longshortjava.lang.Shortvoidjava.lang.VoidQuestion:Readthefollowingprogram:publicclasstest{publicstaticvoidmain(String[]args){intx=3;inty=1;if(x=y)System.out.println("Notequal");elseSystem.out.println("Equal");}}Whatistheresult?A.Theoutputisequal?br>B.TheoutputinnotEqual?br>C.Anerrorat"if(x=y)"causescompilationtofall.D.Theprogramexecutesbutnooutputisshowonconsole.Answer:CQuestion:whatistheclassvariables?Answer:Whenwecreateanumberofobjectsofthesameclass,theneachobjectwillshareacommoncopyofvariables.Thatmeansthatthereisonlyonecopyperclass,nomatterhowmanyobjectsarecreatedfromit.Classvariablesorstaticvariablesaredeclaredwiththestatickeywordinaclass,butminditthatitshouldbedeclaredoutsideoutsideaclass.Thesevariablesarestoredinstaticmemory.Classvariablesaremostlyusedforconstants,variablethatneverchangeitsinitialvalue.Staticvariablesarealwayscalledbytheclassname.Thisvariableiscreatedwhentheprogramstartsi.e.itiscreatedbeforetheinstanceiscreatedofclassbyusingnewoperatorandgetsdestroyedwhentheprogramsstops.Thescopeoftheclassvariableissameainstancevariable.Theclassvariablecanbedefinedanywhereatclasslevelwiththekeywordstatic.Itinitialvalueissameasinstancevariable.Whentheclassvariableisdefinedasintthenit'sinitialvalueisbydefaultzero,whendeclaredbooleanitsdefaultvalueisfalseandnullforobjectreferences.Classvariablesareassociatedwiththeclass,ratherthanwithanyobject.Question:Whatisthedifferencebetweentheinstanceofandgetclass,thesetwoaresameornot?Answer:instanceofisaoperator,notafunctionwhilegetClassisamethodofjava.lang.Objectclass.Consideraconditionwhereweuseif(o.getClass().getName().equals("java.lang.Math")){}Thismethodonlychecksiftheclassnamewehavepassedisequaltojava.lang.Math.Theclassjava.lang.MathisloadedbythebootstrapClassLoader.Thisclassisanabstractclass.Thisclassloaderisresponsibleforloadingclasses.EveryClassobjectcontainsareferencetotheClassLoaderthatdefines.getClass()methodreturnstheruntimeclassofanobject.Itfetchesthejavainstanceofthegivenfullyqualifiedtypename.Thecodewehavewrittenisnotnecessary,becauseweshouldnotcomparegetClass.getName().ThereasonbehinditisthatifthetwodifferentclassloadersloadthesameclassbutfortheJVM,itwillconsiderbothclassesasdifferentclassesso,wecan'tcomparetheirnames.Itcanonlygivestheimplementingclassbutcan'tcompareainterface,butinstanceofoperatorcan.Theinstanceofoperatorcomparesanobjecttoaspecifiedtype.Wecanuseittotestifanobjectisaninstanceofaclass,aninstanceofasubclass,oraninstanceofaclassthatimplementsaparticularinterface.WeshouldtrytouseinstanceofoperatorinplaceofgetClass()method.RememberinstanceofopeatorandgetClassarenotsame.Trythisexample,itwillhelpyoutobetterunderstandthedifferencebetweenthetwo.Interfaceone{}ClassTwoimplementsone{}ClassThreeimplementsone{}publicclassTest{publicstaticvoidmain(Stringargs[]){onetest1=newTwo();onetest2=newThree();System.out.println(test1instanceofone);//trueSystem.out.println(test2instanceofone);//trueSystem.out.println(Test.getClass().equals(test2.getClass()));//false}}*Q1.HowcouldJavaclassesdirectprogrammessagestothesystemconsole,buterrormessages,saytoafile?.TheclassSystemhasavariableoutthatrepresentsthestandardoutput,andthevariableerrthatrepresentsthestandarderrordevice.Bydefault,theybothpointatthesystemconsole.Thishowthestandardoutputcouldbere-directed:Streamst=newStream(newFileOutputStream("output.txt"));System.setErr(st);System.setOut(st);*Q2.What'sthedifferencebetweenaninterfaceandanabstractclass?A.Anabstractclassmaycontaincodeinmethodbodies,whichisnotallowedinaninterface.Withabstractclasses,youhavetoinherityourclassfromitandJavadoesnotallowmultipleinheritance.Ontheotherhand,youcanimplementmultipleinterfacesinyourclass.*Q3.Whywouldyouuseasynchronizedblockvs.synchronizedmethod?A.Synchronizedblocksplacelocksforshorterperiodsthansynchronizedmethods.*Q4.Explaintheusageofthekeywordtransient?A.Thiskeywordindicatesthatthevalueofthismembervariabledoesnothavetobeserializedwiththeobject.Whentheclasswillbede-serialized,thisvariablewillbeinitializedwithadefaultvalueofitsdatatype(i.e.zeroforintegers).*Q5.Howcanyouforcegarbagecollection?A.Youcan'tforceGC,butcouldrequestitbycallingSystem.gc().JVMdoesnotguaranteethatGCwillbestartedimmediately.*Q6.Howdoyouknowifanexplicitobjectcastingisneeded?A.Ifyouassignasuperclassobjecttoavariableofasubclass'sdatatype,youneedtodoexplicitcasting.Forexample:Objecta;Customerb;b=(Customer)a;Whenyouassignasubclasstoavariablehavingasupeclasstype,thecastingisperformedautomatically.*Q7.What'sthedifferencebetweenthemethodssleep()andwait()A.Thecodesleep(1000);putsthreadasideforexactlyonesecond.Thecodewait(1000),causesawaitofuptoonesecond.Athreadcouldstopwaitingearlierifitreceivesthenotify()ornotifyAll()call.Themethodwait()isdefinedintheclassObjectandthemethodsleep()isdefinedintheclassThread.*Q8.CanyouwriteaJavaclassthatcouldbeusedbothasanappletaswellasanapplication?A.Yes.Addamain()methodtotheapplet.*Q9.What'sthedifferencebetweenconstructorsandothermethods?A.Constructorsmusthavethesamenameastheclassandcannotreturnavalue.Theyareonlycalledoncewhileregularmethodscouldbecalledmanytimes.*Q10.CanyoucalloneconstructorfromanotherifaclasshasmultipleconstructorsA.Yes.Usethis()syntax.*Q11.ExplaintheusageofJavapackages.A.Thisisawaytoorganizefileswhenaprojectconsistsofmultiplemodules.Italsohelpsresolvenamingconflictswhendifferentpackageshaveclasseswiththesamenames.Packagesaccesslevelalsoallowsyoutoprotectdatafrombeingusedbythenon-authorizedclasses.*Q12.Ifaclassislocatedinapackage,whatdoyouneedtochangeintheOSenvironmenttobeabletouseit?A.YouneedtoaddadirectoryorajarfilethatcontainsthepackagedirectoriestotheCLASSPATHenvironmentvariable.Let'ssayaclassEmployeebelongstoapackagecom.xyz.hr;andislocatedinthefilec:\dev\com\xyz\hr\Employee.java.Inthiscase,you'dneedtoaddc:\devtothevariableCLASSPATH.Ifthisclasscontainsthemethodmain(),youcouldtestitfromacommandpromptwindowasfollows:c:\>javacom.xyz.hr.Employee*Q13.What'sthedifferencebetweenJ2SDK1.5andJ2SDK5.0?A.There'snodifference,SunMicrosystemsjustre-brandedthisversion.*Q14.WhatwouldyouusetocomparetwoStringvariables-theoperator==orthemethodequals()?A.I'dusethemethodequals()tocomparethevaluesoftheStringsandthe==tocheckiftwovariablespointatthesameinstanceofaStringobject.*Q15.DoesitmatterinwhatordercatchstatementsforFileNotFoundExceptionandIOExceptiponarewritten?A.Yes,itdoes.TheFileNoFoundExceptionisinheritedfromtheIOException.Exception'ssubclasseshavetobecaughtfirst.*Q16.Cananinnerclassdeclaredinsideofamethodaccesslocalvariablesofthismethod?A.It'spossibleifthesevariablesarefinal.*Q17.Whatcangowrongifyoureplace&&with&inthefollowingcode:Stringa=null;if(a!=null&&a.length()>10){...}A.AsingleampersandherewouldleadtoaNullPointerException.*Q18.What'sthemaindifferencebetweenaVectorandanArrayListA.JavaVectorclassisinternallysynchronizedandArrayListisnot.*Q19.WhenshouldthemethodinvokeLater()beused?A.ThismethodisusedtoensurethatSwingcomponentsareupdatedthroughtheevent-dispatchingthread.*Q20.Howcanasubclasscallamethodoraconstructordefinedinasuperclass?A.Usethefollowingsyntax:super.myMethod();Tocallaconstructorofthesuperclass,justwritesuper();inthefirstlineofthesubclass'sconstructor.Forsenior-leveldevelopers:**Q21.What'sthedifferencebetweenaqueueandastack?A.Stacksworksbylast-in-first-outrule(LIFO),whilequeuesusetheFIFOrule**Q22.Youcancreateanabstractclassthatcontainsonlyabstractmethods.Ontheotherhand,youcancreateaninterfacethatdeclaresthesamemethods.Socanyouuseabstractclassesinsteadofinterfaces?A.Sometimes.Butyourclassmaybeadescendentofanotherclassandinthiscasetheinterfaceisyouronlyoption.**Q23.WhatcomestomindwhenyouhearaboutayounggenerationinJava?A.Garbagecollection.**Q24.WhatcomestomindwhensomeonementionsashallowcopyinJava?A.Objectcloning.**Q25.Ifyou'reoverridingthemethodequals()ofanobject,whichothermethodyoumightalsoconsider?A.hashCode()**Q26.Youareplanningtodoanindexedsearchinalistofobjects.WhichofthetwoJavacollectionsshouldyouuse:ArrayListorLinkedList?A.ArrayList**Q27.HowwouldyoumakeacopyofanentireJavaobjectwithitsstate?A.HavethisclassimplementCloneableinterfaceandcallitsmethodclone().**Q28.Howcanyouminimizetheneedofgarbagecollectionandmakethememoryusemoreeffective?A.Useobjectpoolingandweakobjectreferences.**Q29.Therearetwoclasses:AandB.TheclassBneedtoinformaclassAwhensomeimportanteventhashappened.WhatJavatechniquewouldyouusetoimplementit?A.IftheseclassesarethreadsI'dconsidernotify()ornotifyAll().ForregularclassesyoucanusetheObserverinterface.**Q30.Whataccessleveldoyouneedtospecifyintheclassdeclarationtoensurethatonlyclassesfromthesamedirectorycanaccessit?A.Youdonotneedtospecifyanyaccesslevel,andJavawilluseadefaultpackageaccesslevel.TheJ2EEquestionsarecomingsoon.StaytunedforYakovFainonLiveSYS-CON.TV.AskyourquestionstoYakovontheair!=====================IBMjava英文面试题1.whatisoracle.2.whatismajordiffereneceoracle8iandoracle9i.4.tellmesomethingurself.5.pleasetellmeaboutoops.6.whatissingleinheritance.7.whatismultipleinheritance.8.canjavasupportmultipleinheritance.9.whatisinterface.10.whatisdifferenecbetweenabstractclassandinterface.11.howtouprovethatabstraceclasscannotinstantiatedirectly.12.whatisdifferenecebetweenstringandstringbuffer.13.whatisimmutable14.howtowriteaprogramusingsortprogram.15howtowriteaprogramusingunsortprogram.16.whatislegacy.17.whatislegacyapi18.whatislegacyinterface.19.whatismaindifferencehashmapandhastable20.whatismaindifferencebetweenarraylistandvector.21.whatisstrutsframework.22.whataredistributedtechonologies.23.whatisadvantageanddisadvantageofdistributedtechonologies.24.whatismaindifferencebetweenjspandservlets.25.whatisdifferencebetweenprocedureandfunctions.26.whatisjdbc.27.whataretypeofdrivers.28.whatistype4driver.29.howtocollectrequuirementsformurclient.30.whichprocessuseinurproject.31.whatisdeploymentdescriptor.32.whatisheirarchyoffilesinstruts.33.pleasedrawstrutsframewrok.34.pleasedrawj2eearchitecture.35.pleasedrawmvc-2architecture.36.pleasedrawthathowdesignopmodule.37.howtofindafileonlinux.38.howtoconfigureweblogic8.1onlinux.39.whyyouusestrutsframeworkinurproject.40.whatisplatfromindependent41.whatisawtandswing.42.whatisheavywieghtcomponents.43.whatisfeatureofweblgoic8.1.44.whyyouchooseapplicationserveronlinuxanddatabaseserveronaix.45.pleasetellmeabouturproject.46.whatismajorconceptsinoops.47.whyuchoosemvc-2architecture.48.whatisimplicitobject.49.howmanyimplicitobjectsinjsp50.whychooseweblogic8.1otherthananyapplicationserver.51.whatiswaterfallmodelvssdlc52.whatisuseofdataflowdiagrams53.whatisipinurproject.54.whataboutreceptionmodule—————————————————————————————————————————————————————————1.OracleisanRDBMSproductwithDDLandDMLfromacompanycalledOracleInc.2.Differencebetween8iand9iisgivenintheOraclesite3.Questionnotavailable4.Something5.oopsisObjectOrientedProgramming6.whatissingleinheritance.ans:oneclassisinheritedbyonlyotheroneclass7.whatismultipleinheritance.ans:Oneclassinheritingmorethanoneclassatatime8.canjavasupportmultipleinheritance.ans:No9.whatisinterface.ans:Interfacehasonlymethoddeclarationsbutnodefn10.whatisdifferenecbetweenabstractclassandinterface.ans:Inabstractclasssomemethodsmaycontaindefinition,butininterfaceeverymethodshouldbeabstract11.howtouprovethatabstraceclasscannotinstantiatedirectly.ans:Astheydonthaveconstructortheycantbeinstantiated12.whatisdifferenecebetweenstringandstringbuffer.ans:Stringsareimmutablewhereasstringbuffercanbemodified13.whatisimmutableans:Whichcantbechanged14.howtowriteaprogramusingsortprogram.15howtowriteaprogramusingunsortprogram.ans:BothcanbedoneusingjavascriptThisisforSortfunctionSelectTextSort(obj){//sortbytextvarN=obj.options.length;for(vari=0;i<N-1;i++){for(varj=i+1;j<N;j++){if(obj.options[i].text>obj.options[j].text){vari1=(obj.options[i].selected==true)?true:falsevarj1=(obj.options[j].selected==true)?true:falsevarq1=obj.options[j].text;varq2=obj.options[j].value;obj.options[j].text=obj.options[i].text;obj.options[j].value=obj.options[i].value;obj.options[i].text=q1;obj.options[i].value=q2;obj.options[i].selected=(j1&&true)?true:falseobj.options[j].selected=(i1&&true)?true:false}}}returntrue}16.whatislegacy.17.whatislegacyapi18.whatislegacyinterface.ans:legacyissomethingthatisoldintermsoftechnology/system19.whatismaindifferencehashmapandhastableans:Hashtableissynchronised20.whatismaindifferencebetweenarraylistandvector.ans:Vectorissynchronised21.whatisstrutsframework.22.whataredistributedtechonologies.distributedtechnologiesmeansanytechnology/s/wprogramthatarehavingmanycomponentsinmultipleenvironmentsthatinteractwitheachotherdependingonthefunctionalrequirementsanddesign.23.whatisadvantageanddisadvantageofdistributedtechonologies.overdependanceonsingleplatform/singlelanguageisavoided.Applicationcanbebuiltflexibletomeetrequirements.Divisionoflabourispossible.Bestofallthetechnologiesandplatformscanbeoptimallyutilized.Complexityofrequirementscanbereduced.25.whatisdifferencebetweenprocedureandfunctions.'ans:Fuctionscanreturnvalue,procedurescantreturnvalue26.whatisjdbc.ans:ConnectingtoDBfromjavaprogramrequiresJDBC27.whataretypeofdrivers.type1,2,3,429.howtocollectrequuirementsformurclient.isnotajobofatechnicalperson.ItisbetterforaBAtodoit.30.whichprocessuseinurproject.Generallyucansay:Projectrelatedprocess:Analysis,Design,Sign-offDocuments,Implementation,Integration,Testing,UATWorkrelatedprocess:TechnicalDesign,WorkAllocation,CodeReviewChecklist,UnitTestFormwillbepreparedbytheProjectLeadandgiventothedeveloper.DeveloperpreparestheUnitTestCaseImplementsCode,PerformsTestSubmitsCodethroughCVS/VSSSubmitsdocumentsalongwithReleaseChecklisttothetester/leader.31.whatisdeploymentdescriptor.ans:Whichcontainstheinfrnmationlikewhichfiletobeused40.whatisplatfromindependentans:Alanguageissaidtobeplatformindependentifitcanberunonanymachinewithoutmodifyingcode41.whatisawtandswing.ans:AWTareheavyweightcomponentsandswingsarelightweightcomponents46.whatismajorconceptsinoops.ans:Abstraction,polymorphism,encapsulation,inheritance47.whyuchoosemvc-2architecture.ans:InMVC-2controllerisservletratherthanJSPwhichmakesitefficient48.whatisimplicitobject.ans:ImplicitobjectsareasetofJavaobjectsthattheJSPContainermakesavailabletodevelopersineachpage49.howmanyimplicitobjectsinjspans:out,page,session,request,response,application,pagecontext,config1.WhatisthedifferencebetweenanAppletandanApplication?AJavaapplicationismadeupofamain()methoddeclaredaspublicstaticvoidthatacceptsastringarrayargument,alongwithanyotherclassesthatmain()calls.ItlivesintheenvironmentthatthehostOSprovides.

AJavaappletismadeupofatleastonepublicclassthathastobesubclassedfromjava.awt.Applet.Theappletisconfinedtolivingintheuser'sWebbrowser,andthebrowser'ssecurityrules,(orSun'sappletviewer,whichhasfewerrestrictions).

Thedifferencesbetweenanappletandanapplicationareasfollows:1.AppletscanbeembeddedinHTMLpagesanddownloadedovertheInternetwhereasApplicationshavenospecialsupportinHTMLforembeddingordownloading.2.Appletscanonlybeexecutedinsideajavacompatiblecontainer,suchasabrowserorappletviewerwhereasApplicationsareexecutedatcommandlinebyjava.exeorjview.exe.3.Appletsexecuteunderstrictsecuritylimitationsthatdisallowcertainoperations(sandboxmodelsecurity)whereasApplicationshavenoinherentsecurityrestrictions.4.Appletsdon'thavethemain()methodasinapplications.Insteadtheyoperateonanentirelydifferentmechanismwheretheyareinitializedbyinit(),startedbystart(),stoppedbystop()ordestroyedbydestroy().2.Whatarejavabeans?

JavaBeansisaportable,platform-independentcomponentmodelwrittenintheJavaprogramminglanguage,developedincollaborationwithindustryleaders.Itenablesdeveloperstowritereusablecomponentsonceandrunthemanywhere--benefitingfromtheplatform-independentpowerofJavatechnology.JavaBeansactsasaBridgebetweenproprietarycomponentmodelsandprovidesaseamlessandpowerfulmeansfordeveloperstobuildcomponentsthatruninActiveXcontainerapplications.

Javabeansisverypowerfultoolyoucanuseinyourservlet/JSPbridge.YoucanusetheservletstobuildthebeanandcanbepassedovertotheJSPforreading.ThisprovidestightencapsulationofthedatawhilepreservingthesanctityofservletsandJSP.3.WhatisRMI?

RMIstandsforRemoteMethodInvocation.Traditionalapproachestoexecutingcodeonothermachinesacrossanetworkhavebeenconfusingaswellastediousanderror-pronetoimplement.Thenicestwaytothinkaboutthisproblemisthatsomeobjecthappenstoliveonanothermachine,andthatyoucansendamessagetotheremoteobjectandgetaresultasiftheobjectlivedonyourlocalmachine.

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论