Você está na página 1de 6

2/23/2015

Javainterviewquestionsandanswerspart2

Javainterviewquestionsandanswerspart2
Search

Interview Currentaffairs Civilservices Banking Engineering MBA GD Placementpapers HR CV Coverletter Aptitude English Onlinetest
Askquestion!

JavaPDF
JavaInterviewQuestions
JavaSourceCode
Interviewquestions

Javainterviewquestionsandanswerspart2

Javainterviewquestions
JavaFAQs

Java1Java2Java3Java4Java5Java6Java7Java8Java9Java10Java11Java12Java
13Java14Java15Java16Java17Java18Java19Java20Java21Java22

DownloadJava/OracleFAQ

TwoStringobjectswithsamevaluesnottobeequalunderthe==operator.ExplainHow.

TestJDBCskills New

The==operatorcomparesreferencesandnotcontents.Itcomparestwoobjectsandiftheyarethesameobject
inmemoryandpresentinthesamememorylocation,theexpressionreturnstrueelseitreturnsfalse.............
Readansw er

Explainstaticinjava.
Astaticvariableisattachedwiththeclassasawholeandnotwithspecificinstancesofaclass..............
Readansw er

TestJavaskills New

TestEJBskills New

Javaobject,class,method
Javaoperator
Javavariables
Javaoverloadingoverriding
Javaabstractclasses

ExplainGarbagecollectionmechanisminJava.
GarbagecollectionisalsocalledautomaticmemorymanagementasJVMautomaticallyremovestheunused
variables/objects(valueisnull)fromthememory..............
Readansw er

Javadatatypes
Javaarrays
Javaexception
Javaevents

CanAbstractClasshaveconstructors?
Abstractclasscanhaveaconstructor.Butaswecan'tinstantiateabstractclass,wecan'taccessitthroughthe
object..............
Readansw er ......
ExplainhowJavaaddressestheissueofportabilityandsecurity.
AddressingPortability:Manycomputersofdifferenttypeswithseveraloperatingsystemsareconnectedto
network/internet.............
Readansw er

WhydoesJavahavedifferentdatatypesforintegersandfloatingpointvalues?
Theintegerandfloatingpointtypesaredifferentintermsoftheconsumptionofthebitswhichrepresentthem.
Therearecertaindatatypeswhicharerightlyaptforspeed..............
Readansw er

FeaturesofJava
Javaomitsrarelyused,poorlyunderstoodfeaturesthoseareavailableinC++.Thesefeaturesincludeoperator
overloading,multipleinheritance,destructors,allocationandfreeingofmemory........
Readansw er

Javavirtualmachine
Javainputandoutput
JavaURLconnections
Javasockets
JNDI
Javaapplets
JavaAWT
JavadrawingAWTcomponents
Corejava
JDBC
JSP
EJB
J2EE
JNI
Servlets
Struts

ExplainwhyJavaiscalledasPlatformindependentlanguage.ExplainhowJavaexecutableexecutesonany
platformwhereJVMisavailable.

Javathreading

JavabytecodecanrunonanyOSwithjavainstalled.JVMtakescareofexecutingofnativebytecode........

JMS

Readansw er

ExplainJavaarchitecture,i.e.typicalJavaenvironment.
Javaprogramminglanguage,Javaclassfileformat,JavaApplicationProgrammingInterface,Javavirtual
machine......
Readansw er

http://www.careerride.com/JavaInterviewpage2.aspx

J2ME

Javawebservices
RMI
Internationalization
JavaScript
EJBArchitecture

1/6

2/23/2015

Javainterviewquestionsandanswerspart2
ExplainthefeaturesofJavaclass.ExplainFields,Methods,andAccessLevels.

Spring

AJavaclasshasattributes,staticblocks,nonstaticblocks,constructors,methodsandinnerclasses.Fields:
Fieldsarereferredtodatamemberswhomaretobeaccessedbythemethods,constructorsofthesameclass
andmethodsofotherclasses........

JavaTransactionAPIJTA

Readansw er

Javatransactionservices,JTS

Whatisaconstructor?Explainthedifferencesbetweenmethodsandconstructor.

JavaGUIFrameworkinterview

Aconstructorisablockofcodewiththesamenameofitsdefiningclasswithoutreturntype
Ex:Employee(){}//TheclassnameisEmployee............

SWT/JFaceinterview

Readansw er

Whatisinstancemembers?Explainwithanexample
Instancemembersaretheattributesandmethodsofaclass.Theyshareonecopyeachperobject.Sincean
objectisaninstanceofaclass,memoryhasbeensetasideforeachobjecttocontainitsowncopiesofinstance
members..........
Readansw er

JBOSS

MVCandJface
JavaServerFaces
Hibernateinterview
JAAS
JavaMailinterview
Tomcat

WhatareJavapackages?ExplaintheimportanceofJavapackages.

MIDPinterview

Apackageisagroupof.classfiles.
The.classfilesareorganizedintonamespaces.ThejavapackagesarecompressedintofilesknownasJava
Archivefiles........

Weblogicinterview

Readansw er

Websphereinterview

ExplainJavaGarbagecollector.Whygarbagecollection?BriefexplanationofGarbagecollectionalgorithms.

Antinterview

Rubyinterview
jQueryinterview

Garbagecollectionistheprocessofreclaimingheapmemoryspacebyremovingorphanobjects
Theobjectsthatarenolongerneededbytheapplicationaregarbagecollected
Garbagecollectionisdoneautomatically..............
Readansw er

AspectOrientedProgramming
Javadesignpatterns
Javalocalization

Explaintheimportanceof'super'keywordinJava.Writecodetodepicttheusesof'super'keyword.
Thekeywordsuperisusedforreferringparentclassinstance
Samedatamembersofsuperclasshidesthevariablesbythesubclass
Ex:super.number//numberofsuperclassisaccessed.............
Readansw er

DefineMethodoverloading.Explainitsuses.ProvideacodesampletoexplaintheusesofMethod
overloading
Javasupportstodefinetwoormoremethodswithsamenameswithinaclass.
Allthemethodsshoulddifferineitherbythenumberortypeofparameters.
ThemethodSystem.out.println()receivesmultipleparameters...............
Readansw er

DescribeJavastringclass.ExplainmethodsofJavastringclass.ExplainthecharacteristicsofStringBuffer
class
StringClass:
TheStringclassisimmutable.
ThecontentsoftheStringobjectcannotbechanged.
Stringclassisfinalclass.Thatimpliesitcannothavesubclasses.
Stringobjectscanbeconcatenatedbyusing+and+=operators...............
Readansw er

WhatisJavainnerclass?Explainthetypesofinnerclasses,i.e.Staticmemberclasses,Memberclasses,
Localclasses,Anonymousclasses
InnerClass:AclassdefinedinsideanotherclassiscalledanInnerClass.
Typesofinnerclasses:..........
Readansw er

ExplainaboutJavareflectionclass.
Classes,interfaces,methods,instancevariablescanbeinspectedatruntimebyusingreflectionclass
Toinspecthenamesoftheclasses,methods,fieldsetc.neednotbeknown
ReflectioninJavaispowerfulanduseful,whenobjectsareneededtobemappedintotablesinadatabaseat
runtime..........
Readansw er

WritesomeimportantfeaturesofSwing.
Platformindependent:Swingisplatformindependentinbothexpressionandimplementation
Extensible:Allowspluggingofcustomimplementationsofspecifiedframeworkinterfaces.Userscanprovide
customcomponentimplementationsbyoverridingthedefaultimplementations..................

http://www.careerride.com/JavaInterviewpage2.aspx

2/6

2/23/2015

Javainterviewquestionsandanswerspart2
Readansw er

ExplaindifferentlayoutmanagerinJava.
Alayoutmanagerorganizestheobjectsinacontainer
Differentlayoutsareusedtoorganizeortoarrangeobjects................
Readansw er

WhatisuserdefinedException?Explainwithanexample.
AuserdefinedexceptionisextendedbyExceptionclass.
Unconventionalactionsaredealtwithuserdefinedexceptions
ApplicationdemandedexceptionsotherthanAPIsaredefinedasuserdefinedexceptions.Ex:Whenthebalance
ofanaccountisbelowzeroafterwithdrawl,anexceptioncanberaisedlikeNegativeBalanceException...........
Readansw er

ExplainhowtousethreadclassforMultithreadinginJava.Explainwithanexample.
Threadsareusedinjavaby
a.extendingtheThreadclass
b.implementingtheRunnableinterface..............
Readansw er

DifferencebetweenStreamclassesandReaderwriterclasses
StreamClasses:Theyarebyteoriented,TheyneversupportUnicodecharacters,Supports8bitstreams...........
Readansw er

WhatisobjectSerialization?ExplaintheuseofPersistingobject.
PersistingthestateofanobjectinastoragemediaisknownasObjectSerialization
Savingandretrievingdataisoneofthecriticaltasksfordevelopers
Bypersistingobjects,applicationscanefficientlyhandlethem,asonlyoneobjectcanbeusedatagivenpointof
time.............
Readansw er

ExplainthecharacteristicsofJavasocketclass.
Thefollowingarecertaincharacteristicsthatsocketshare:
1.Thesocketisavailableaslongasthenetworkprocessmaintainsanopenlinktothesocket
2.Asocketcanbenamedinordertocommunicatewithothersocketsinanetwork
3.Communicationisperformedbythesocketsinnetworkwhentheserverreceivestheconnectionsand
requestsfromthem...............
Readansw er

StatethefunctionalitiesofimportantclassesinJDBCpackages.
TheimportantinterfacesinJDBCare:
java.sql.DriverManager:UsedtomanageJDBCdrivers,thusestablishesaconnectiontothedatabaseserver
java.sql.ConnectionUsedforestablishingconnectiontoadatabase.AllSQLstatementsexecuteswithinthe
connectioncontext...................
Readansw er

Whatisendianness?Describethewaysanintegerisstoredinmemory.
Endiannessistheprocessoforderingtheaddressablesubunitssuchaswords,bytesorbitsinalongerword
thatistostoreinanexternalmemory...............
Readansw er

ExplainwhyJavausesUnicode
Toenableacomputersystemforstoringtextandnumberswhichisunderstandablebyhumans,thereshouldbe
acodethattransformscharactersintonumbers...................
Readansw er

Whatarethedifferentloopsavailableinjava?Howdowechoosetherightloopforaspecificjob?
Aloopisasetofstatementsthatissupposedtorepeatoneormoretimes.Javasupports3loops................
Readansw er

Explainwhywedontneedtousenewforvariablesoftheprimitivetypes,suchasintorfloat
Thekeywordnewisusedforcreationofobjects.Primitivetypesaretouseconstantsbutnotobjects.............
Readansw er

Whatisfinalize()?Isfinalize()similartoadestructor?

http://www.careerride.com/JavaInterviewpage2.aspx

3/6

2/23/2015

Javainterviewquestionsandanswerspart2
Thefinalize()methodofjavaisinvokedbyJVMtoreclaimtheinaccessiblememorylocation,Whentheorphan
object(withoutreference)istobereleased,JVMinvokesthefinalize()method,whenthenext..................
Readansw er

WhydoesStringdefinetheequals()method?CantIjustuse==?
Theequals()methodisdefinedinStringclassinordertotestwhethertwostringsvaluesaresamesequenceof
characters.Themethodisforexclusivelytestingstringobjects,butnotanyotherobjects..................
Readansw er

Stringobjectsareimmutableinjava.Explainhowtocreateastringthatcanbechanged.
AstringobjectthatiscreatedusingStringclassisimmutable.Thecharactersoftheobjectcannotbechanged/
modified.Therearesomemethods,suchassplit(),substring(),beginsWith()etc...................
Readansw er

Canwepassaprimitivetypebyreferenceinjava?How
Primitivetypescanbepassedbyreference.1.Bystoringtheprimitivetypevalueinanarrayofsingleelementand
passingit.................
Readansw er

Whatdoyoumeanbythetermsignatureinjava?
Asignatureinjavaisacombinationofelementsinalistsuchasconstructorandmethodstherebydistinguishing
themfromotherconstructorsandmethods..................
Readansw er

Staticnestedclassvs.anonstaticone.
Astaticnestedclasscannotdirectlyaccessnonstaticmethodsorfieldsofaninstanceofitsenclosingclass.
Theycanbeaccessedbycreatingtheobjectofthenestedinnerclass.Whereasnonstaticnested....................
Readansw er

Explainwhenweshouldmakeaninstancevariableprivate.
Aninstancevariablecanbedeclaredasprivatetopromoteinformationhiding.............
Readansw er

OverriddenmethodsinJava
Overriddenmethodsofsuperclassinsubclassallowaclasstoinheritandbehavecloseenough.Toavoid
namingconflictandsignatureandtypeandnumberofparameters..............
Readansw er

IsC++accessspecifiercalledprotectedissimilartoJavas?
Thejavaaccessspecifierprotectedisplacedproceedingthememberoftheclassandtheaccesscontrolis
applicableonlyforthatparticulardefinition...............
Readansw er

Whyshouldwecatchsuperclassexceptions?
EveryexceptionisrepresentedbytheinstanceofThrowableoritssubclasses.Anobjectcancarrythe
informationfortheexceptionraisingpointtotheexceptionhandlerwhichcatchesit...............
Readansw er

Whywouldwemanuallythrowanexception?
Whenanexceptionistobehandledwhicharenotjavaclasslibrary,auserdefinedexceptioncanbethrown.An
exceptioncanbethrownexplicitly,whenaconditionismet.Inotherwords,inasituation.............
Readansw er

Whatischainedexceptionsinjava?
Onceanapplicationfindsanexception,respondsanexceptionbythrowinganotherexception.Itcausesanother
exception.Knowinganexceptionthatcausesanotherexceptionisveryuseful.....................
Readansw er

Whenshouldwecreateourowncustomexceptionclasses?
Thetermexceptionletstheprogrammertoknowthatthereissomethingexceptionalhasoccurredinthe
program.ApartfromJavaexceptionclasslibrary,acustom.................
Readansw er

Whatareprimitivetypewrappersclasses?Explainthepurposeofprimitivetypewrapperclasses.

http://www.careerride.com/JavaInterviewpage2.aspx

4/6

2/23/2015

Javainterviewquestionsandanswerspart2
Primitivetypewrapperclassesorsimplywrapperclassesareavailableinjava.langpackageforprovidingobject
methodsforalltheeightprimitivetypes.Allthewrapperclassobjectsareimmutable.................
Readansw er

Whydoyourecommendthatthemainthreadbethelasttofinish?
Inanapplication,aprogramcontinuestorununtilallofthethreadshaveended.Hence,themainthreadtofinish
atlastisnotarequirement.Itisagoodprogrammingpracticetomakeittorunlasttofinish................
Readansw er

WhydoesJavahavetwowaystocreatechildthreads?Whichwayisbetter?
Javathreadscanbecreatedgraciouslyintwoways:implementingtheRunnableinterfaceandextendingThread
class.............
Readansw er

TipsoneffectivelyusingMultithreadingtoimprovetheefficiencyofmyprograms.
Inmultipleprocessorsystems,alargealgorithmwillsplittheprocessintothreads.Sothatdifferentprocessors
canhandledifferentthreads...................
Readansw er

Enumerationsvsfinalvariablesinjava.
Enumerationistypesafe.Whereasfinalvariablesarenot.Enumerationsupportstohaveablendofvarious
values............
Readansw er

Isitpossibleforamethodotherthanpaint()orupdate()tooutputtoanappletswindow?Explainhow.
YesIispossibleforamethodotherthanpaint()orupdate()tooutputanappletswindow.Itismandatoryto
obtainagraphicscontextbyinvokinggetGraphics()method............
Readansw er

WhatisbytecodeandwhyisitimportanttoJavasuseforInternetprogramming?
ThecompiledJavasourcecodeisknownasbytecode.Javacompilergeneratesthebytecode.Thebytecode
canrunonanyplatform/machineregardlessofthesystemsarchitecture..........
Readansw er

WhydoesJavastrictlyspecifytherangeandbehaviorofitsprimitivetypes?
Javastrictlyspecifiestherangesforprimitivevalues.Theselectionofvaluesinintegerorfloatingpointtypes
differsbasedontherequirementofanapplication..................
Readansw er

WhatisJavascharactertype,andhowdoesitdifferfromthecharactertypeusedbymanyother
programminglanguages?
ThechardatatypeinJavaisasingle16bitUnicodecharacter.Itrepresentsacharacterthatcouldbeanyoneof
theworldlanguages..................
Readansw er

Explainthedifferencebetweentheprefixandpostfixformsoftheincrementoperator.
Theprefixoperator++addsonetoitsoperand/variableandreturnsthevaluebeforeitisassignedtothe
variable.Inotherwords,theincrementtakesplacefirstandtheassignmentnext.............
Readansw er

WhatisthedifferencebetweentheStringmethodsindexOf()andlastIndexOf()?
ThemethodindexOf()returnsthefirstoccurrence(index)ofagivencharacteroracombinationasparameterina
givenstring.................
Readansw er

Explainthedifferencebetweenprotectedanddefaultaccess.
Thedefaultaccessspecifierisonewhichisnotspecifiedwithakeyword.Ifnoaccessspecifier(anyoneof
private,protected,public)ismentioneditisknownasthedefaultaccessspecifier.............
Readansw er

http://www.careerride.com/JavaInterviewpage2.aspx

5/6

2/23/2015

Javainterviewquestionsandanswerspart2

WriteyourcommentShareKnowledgeandExperience
DiscussionBoard
thanksforinterviewquestions
veryhelpfultofreshersbatch.....thanksalot.
muralijillellamudi123201212:29PM

Home| Aboutus | Sitemap| Contactus


Copyright20082015CareerRide.com.Allrightsreserved. Termsofuse |FollowusonFacebook!
Bookm arkto:

http://www.careerride.com/JavaInterviewpage2.aspx

6/6

Você também pode gostar