0% found this document useful (0 votes)
476 views2 pages

Java Developers Guide - Capgemini Interview Questions and Answers For Java 3-8 Year Experience

This document contains answers to common Java and web development interview questions. It discusses Java literals, garbage collection, differences between String objects and references, singleton classes, differences between JSP and Servlets, the Struts Validator framework, differences between Hibernate Session and SessionFactory, and what Hibernate Query Language (HQL) is. Key topics covered include object instantiation, memory management, MVC architecture, validation, caching, and querying data.

Uploaded by

Rohini Bauskar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
476 views2 pages

Java Developers Guide - Capgemini Interview Questions and Answers For Java 3-8 Year Experience

This document contains answers to common Java and web development interview questions. It discusses Java literals, garbage collection, differences between String objects and references, singleton classes, differences between JSP and Servlets, the Struts Validator framework, differences between Hibernate Session and SessionFactory, and what Hibernate Query Language (HQL) is. Key topics covered include object instantiation, memory management, MVC architecture, validation, caching, and querying data.

Uploaded by

Rohini Bauskar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 2

1.Tellmeaboutyourself?

Ans:Giveyourbriefintroduction.
2.Explainaboutyourcurrentproject?
Ans:Itsquiteeasytodescribeyourprojectsandyourkeyroleonthisproject.But,becarefulandgetreadyabout
thefunctionalitywhenyouaredescribingyourworkingmodule/partoftheproject.Showyourconfidencethatyou
havedonethemajorpartandyoucanfacechallengesinfuture.
3.HowmanytypesofliteralsarethereinJAVA?
Ans:Theliteralsmeansthevalueyouareassigningtovariable.Youcanspecifythebelowtypesofliteralin
java.Aspertheprimitivedatatypes(int,short,long,float,double,boolean,char,etcthereisrespectiveliteral.Some
literalneedstobeendedwithaspecificcharacter.ReadMore.
longvar=20L//specifyLorlforlongliteral
intvar=20//Ifnotmentionedanycharacterthenitscanbeshortorint
charvar=A
floatvar=10.44f//specifyforFforfloatliteral
doublevar=10.44
booleanvar=true//orfalse

4.WhatismeantbyGarbagecollection?
Ans:Garbagecollectionisaautomaticfeatureofjavaforcleaningtheunusedobjectfromheap.Ithelpsto
developerforreleasingthereservedmemorywithoutanyextraeffortbydeveloper.Ithelpsdevelopertosavetime
andextramentaltensionforhandlingobjectallocationinmemory.Whenthereisnoreferencetoanobjectfound,it
willcleanthatobjectfrommemory.YoucanrunthegarbagecollectionexplicitlybyusingSystem.gc().
5.Diffferencebetweenstrings=newstring()andstrings="HiDude"?
Ans:Bothstatementsaredifferenttoeachother.Alwaysnewkeywordisusedtocreateobject.
Strings=newString()//Thisstatementcreatesnewobjectinheap.Sistheobjecthere.
Strings=HiDude//Thisstatementdonotcreateobject,itscreatingreferenceanditsstoringinStringConstant
Pool.Sisthereferencehere.
6.Whatissingletonclass?whereisitused?
Ans:ViewAnswer
7.WhatisthedifferencebetweenJSPandServlets?
Ans:AssimpleJSPisprecompiledbutServletsarenot.JSPisspeciallyusefordisplaying/populatingthedataon
browser.IfwetakeanexampleofMVCarchitectureJSPplaystheroleofView(V).But,Servletsareusedtohandle
therequestandprocessthebusinesslogic.InMVCarchitectureServletsareknowsasController(C).
8.Whatisthedifferenceinusingrequest.getRequestDispatcher()andcontext.getRequestDispatcher()?
Ans:BotharetakingStringparameter,butrequest.getRequestDispatcher()willdispatchtherequestinsidethe
application.Whereascontext.getRequestDispatcher()willdispatchtherequestoutsidethecontextalso.Ifyouare
usingabsolutepathfordispatchingthenbotharesimilar.
9.HowtheJSPfilewillbeexecutedontheServerside?
Ans:Firstitsconvertedtojavafile.Thenitscompiledbyjavacompilerandcreatesthe.classfile.Nowonceyou
getthe.classfileyoucanexecuteit.InternallyaJSPconvertsintorespectiveservlet.

Conversion=>Compilation=>Execution
10.WhatisActionServlet?
Ans:ActionServletprovidesthecontrollerinstrutsapplicationwithMVC(ModelViewController)Model2.
ActionServletisasubclassofjavax.servlet.http.HttpServlet.Ithasfewmethodslike
doGet(),doPost(),destroy(),etc.

11.WhatisStrutsValidatorFramework?
Ans:Strutsprovidesaconvenientwaytovalidate.Basicallyweareusingtwoxmlconfigurationfileforconfiguring
suchasValidator.xmlandvalidationrule.xml.validationrule.xmldefinestheruleofvalidationlikenumberformat
validation,emailvalidation.ApartfromthisActionFormhavingvalidate()methodwhichwecanimplementfor
validatingtheformdata.
12.WhatisthedifferencebetweentheSessionandSessionFactoryinhibernate?
Ans:SessionandSessionFactoryareplayingaprominentroleinhibernate.SessionFactoryisusedtocreate
Sessionanditscreatedonceduringstartingoftheapplication.YoucanhaveonlyoneSessionFactoryper
application.SessionFactoryisalsocalled2ndlevelcache.But,Sessioncouldbemanyperapplication.Sessionis
beingcreatedbyusingSessionFactoryobject.Sessioniscalled1stlevelcache.
13.WhatisHQL?
Ans:HQLstandsforHibernateQueryLanguage.ItsfullyobjectorientedandquitesimilarwithSQL.Itsupports
associationandjoinsforeffectiveentityrelationship.

You might also like