2024年5月6日发(作者:)

BradyZhu:@

1

/

13

115questionstotal,everythingfrombasicstoJDBCconnectivity,

AWTandJSP.

Whatisthedifferencebetweenproceduralandobject-orientedprograms?-a)In

proceduralprogram,programminglogicfollowscertainproceduresandtheinstructions

rogram,unitofprogramisobject,whichis

nothingbutcombinationofdataandcode.b)Inproceduralprogram,dataisexposedto

thewholeprogramwhereasinOOPsprogram,itisaccessiblewithintheobjectandwhich

inturnassuresthesecurityofthecode.

WhatareEncapsulation,InheritanceandPolymorphism?-Encapsulationisthe

mechanismthatbindstogethercodeanddataitmanipulatesandkeepsbothsafefrom

tanceistheprocessbywhichoneobjectacquires

rphismisthefeaturethatallowsoneinterfaceto

beusedforgeneralclassactions.

WhatisthedifferencebetweenAssignmentandInitialization?-Assignmentcanbe

doneasmanytimesasdesiredwhereasinitializationcanbedoneonlyonce.

WhatisOOPs?-Objectorientedprogrammingorganizesaprogramarounditsdata,i.

e.,ct-orientedprogram

canbecharacterizedasdatacontrollingaccesstocode.

WhatareClass,ConstructorandPrimitivedatatypes?-Classisatemplateformultiple

nesatypeofobject

accordingtothedatatheobjectcanholdandtheoperationstheobjectcanperform.

Constructorisaspecialkindofmethodthatdetermineshowanobjectisinitializedwhen

ivedatatypesare8typesandtheyare:byte,short,int,long,float,double,

boolean,char.

WhatisanObjectandhowdoyouallocatememorytoit?-Objectisaninstanceofa

classanditisasoftwareunitthatcombinesastructuredsetofdatawithasetof

objectiscreatedusing

newoperator,memoryisallocatedtoit.

Whatisthedifferencebetweenconstructorandmethod?-Constructorwillbe

automaticallyinvokedwhenanobjectiscreatedwhereasmethodhastobecalled

explicitly.

Whataremethodsandhowaretheydefined?-Methodsarefunctionsthatoperateon

scancommunicatewitheachother

definitionhasfourparts.

Theyarenameofthemethod,typeofobjectorprimitivetypethemethodreturns,alistof

dmethod’

firstthreepartsmentionedabove.

WhatistheuseofbinandlibinJDK?-Bincontainsalltoolssuchasjavac,appletviewer,

awttool,etc.,whereaslibcontainsAPIandallpackages.

BradyZhu:@

BradyZhu:@

Whatiscasting?-Castingisusedtoconvertthevalueofonetypetoanother.

Howmanywayscananargumentbepassedtoasubroutineandexplainthem?-An

epassingbyvalueandpassingbyreference.

Passingbyvalue:Thismethodcopiesthevalueofanargumentintotheformalparameter

gbyreference:Inthismethod,areferencetoanargument(not

thevalueoftheargument)ispassedtotheparameter.

Whatisthedifferencebetweenanargumentandaparameter?-Whiledefining

method,singthose

methods,valuespassedtothosevariablesarecalledarguments.

Whataredifferenttypesofaccessmodifiers?-public:Anythingdeclaredaspubliccan

e:Anythingdeclaredasprivatecancan’

ted:Anythingdeclaredasprotectedcanbeaccessedbyclassesinthe

tmodifier:Canbeaccessed

onlytoclassesinthesamepackage.

Whatisfinal,finalize()andfinally?-final:finalkeywordcanbeusedforclass,method

classcannotbesubclassedanditpreventsotherprogrammersfrom

methodcancan’tbeoverridden.

ze():finalize()methodisusedAfinalvariablecancan’

justbeforeanobjectisdestroyedandcanbecalledjustpriortogarbagecollection.

finally:finally,akeywordusedinexceptionhandling,createsablockofcodethatwillbe

executedafteratry/catchblockhascompletedandbeforethecodefollowingthe

try/

example,ifamethodopensafileuponexit,thenyouwillnotwantthecodethatcloses

nallykeywordis

designedtoaddressthiscontingency.

WhatisUNICODE?-Unicodeisusedforinternalrepresentationofcharactersand

stringsandituses16bitstorepresenteachother.

WhatisGarbageCollectionandhowtocallitexplicitly?-Whenanobjectisnolonger

referredtobyanyvariable,

()methodmaybeusedtocallitexplicitly.

Whatisfinalize()method?-finalize()methodisusedjustbeforeanobjectis

destroyedandcanbecalledjustpriortogarbagecollection.

WhatareTransientandVolatileModifiers?-Transient:Thetransientmodifierapplies

enttovariablesonlyanditisnotstoredaspartofitsobjectobject’

le:Volatilemodifierappliestovariablesonlyandittells

thecompilerthatthevariablemodifiedbyvolatilecanbechangedunexpectedlybyother

partsoftheprogram.

Whatismethodoverloadingandmethodoverriding?-Methodoverloading:Whena

methodinaclasshavingthesamemethodnamewithdifferentargumentsissaidtobe

overriding:Whenamethodinaclasshavingthesame

methodnamewithsameargumentsissaidtobemethodoverriding.

BradyZhu:@