You are on page 1of 3

1.Whatisthepurposeofserialization?

Answer:Serializationistheconversionofanobjecttoaseriesofbytes,sothattheobjectcanbeeasily
savedtopersistentstorageorstreamedacrossacommunicationlink.Thebytestreamcanthenbe
deserialisedconvertedintoareplicaoftheoriginalobject.
Source|Example
2.WhatisthedifferencebetweenJDKandJRE?
Answer:JavaDevelopmentKit(JDK)isthemostwidelyusedJavaSoftwareDevelopmentKit.JavaRuntime
Environment(JRE)isanimplementationoftheJavaVirtualMachinewhichexecutesJavaprograms.
Source|JDKWiki|JVMWiki
3.Whatisthedifferencebetweenequals()and==?
Answer:Equalsisintendedtochecklogicalequalityand==checksifbothreferencespointtosameobject.
(ThanksSandeep)
a==b;//Comparesreferences,notvalues.
a.equals(b);//Comparesvaluesforequality.

Source
4.WhenwillyouuseComparatorandComparableinterfaces?
Answer:java.util.Comparatorandjava.lang.Comparable
java.util.Comparatorcomparessomeotherclasssinstances,whilejava.lang.Comparablecomparesitself
withanotherobject.
Source|Example
5.Whatisthewait/notifymechanism?
Answer:Thisdealswithconcurrentprogramming.Thewait()andnotify()methodsaredesignedtoprovide
amechanismtoallowathreadtobeblockuntilaspecificconditionismet.
However,java.util.concurrentshouldbeusedinsteadofwait()andnotify()toreducecomplexity.
Source|JavaAPI|JavaTechnicalArticle
6.Whatisthedifferencebetweencheckedanduncheckedexceptions?
Answer:
Ingeneral,uncheckedexceptionsrepresentdefectsintheprogram(bugs),whicharenormallyRuntime
exceptions.
Furthermore,checkedexceptionsrepresentinvalidconditionsinareasoutsidetheimmediatecontrolofthe
program.
Source
7.Whatisthedifferencebetweenfinal,finallyandfinalize?
Answer:finalisthekeywordtodeclareaconstantANDpreventsaclassfromproducingsubclasses.
(ThanksTomEllis)
finallyisablockofcodethatalwaysexecuteswhenthetryblockisfinished,unlessSystem.exit()was
called.finalize()isanmethodthatisinvokedbeforeanobjectisdiscardedbythegarbagecollector.
Source|FinalUsage|FinallyUsage|Finalize()

8.Whatisthedifferencebetweenwebserverandappserver?
Answer:AWebserverexclusivelyhandlesHTTPrequests,whereasanapplicationserverservesbusiness
logictoapplicationprogramsthroughanynumberofprotocols.
Source
9.ExplaintheStruts1/Struts2/MVCapplicationarchitecture?
Answer:StrutswasadoptedbytheJavadevelopercommunityasadefaultwebframeworkfordeveloping
webapplications
TheMVC(Modelviewcontroller)anapplicationthatconsistofthreedistinctparts.Theproblemdomainis
representedbytheModel.TheoutputtotheuserisrepresentedbytheView.And,theinputfromtheuser
isrepresentedbyController.
Source
10.Whatisthedifferencebetweenforwardandsendredirect?
Answer:Bothmethodcallsredirectyoutonewresource/page/servlet.Thedifferencebetweenthetwois
thatsendRedirectalwayssendsaheaderbacktotheclient/browser,containingthedatainwhichyou
wantedtoberedirected.
Source
11.Howdoesa3tierapplicationdifferfroma2tierone?
Answer:Tiersarethephysicalunitsofseparationordeployment,whilelayersarethelogicalunitsof
separation.
Imaginethatyouredesigninganecommercewebsite.A3tierarchitecturewouldconsistofwebpages,a
webserverandadatabase,withthecorresponding3layersbeingthePresentation,BusinessLogicand
Databaselayers.
Ifyoutakethedatabasetierandlayeroutthenyourhavea2tierarchitecture.
Source
12.Howdoestheversioncontrolprocessworks?
Answer:Initiate,pull,branch,merge,commit,push.
(Init)Makeyourownrepository.(Pull)Downloadanexistingrepositoryfromaurl.(Branch/Merge)Make
revisions.Committhenpushyourmodifications.

GitCheatSheet
13.WhatisthedifferencebetweenJARandWARfiles?
Answer:JARfiles(JavaARchive)allowsaggregatingmanyfilesintoone,itisusuallyusedtoholdJava
classesinalibrary.
WARfiles(WebApplicationaRchive)storesXML,javaclasses,andJavaServerpagesforWebApplication
purposes.
Source
14.WhatisaLeftouterjoin?
Answer:ThisdealswithSQL.Leftouterjoinpreservestheunmatchedrowsfromthefirst(left)table,
joiningthemwithaNULLrowintheshapeofthesecond(right)table.
Source|JoinsWiki
15.WhatisthedifferencebetweenUNIONandUNIONALL?
Answer:ThisdealswithSQL.UNIONonlyselectsdistinctvalues,UNIONALLselectsallvalues.

You might also like