Вы находитесь на странице: 1из 3

2/23/2015

JavainterviewquestionsandanswersPart17

JavainterviewquestionsandanswersPart17
Search

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

JavaPDF
JavaInterviewQuestions
InstallJava
Interviewquestions

JavainterviewquestionsandanswersPart17

Javainterviewquestions
JavaFAQs
DownloadJava/OracleFAQ

Java1Java2Java3Java4Java5Java6Java7Java8Java9Java10Java11Java12Java
13Java14Java15Java16Java17Java18Java19Java20Java21Java22

TestJavaskills New
TestJDBCskills New

Whatisthepurposeofapachetomcat?
ApacheserverisastandaloneserverthatisusedtotestservletsandcreateJSPpages.Itisfreeandopen
sourcethatisintegratedintheApachewebserver.Itisfast,reliableservertoconfiguretheapplicationsbutitis
hardtoinstall.Itisaservletcontainerthatincludestoolstoconfigureandmanagetheservertorunthe
applications.ItcanalsobeconfiguredbyeditingXMLconfigurationfiles.

Writeaprogramtoshowthefunctionalityofservlets
Theservletsisbeingwrittenlikeanormalapplication.Theprogramisasfollows:

TestEJBskills New

Javaobject,class,method
Javaoperator
Javavariables
Javaoverloadingoverriding
Javaabstractclasses

importjava.io.*
importjavax.servlet.*
importjavax.servlet.http.*
publicclassHelloWWWextendsHttpServlet{
publicvoiddoGet(HttpServletRequestrequest,HttpServletResponseresponse)
throwsServletException,IOException{
response.setContentType("text/html")
PrintWriterout=response.getWriter()
StringdocType=
"<!DOCTYPEHTMLPUBLIC\"//W3C//DTDHTML4.0"+"Transitional//EN\">\n"
out.println(docType+"<HTML>\n"+"<HEAD><TITLE>HelloWWW</TITLE></HEAD>\n"+"<BODY>\n"+"
<H1>HelloWWW</H1>\n"+"</BODY></HTML>")
}
}

Javadatatypes

ThisistheformatoftheservletwhichisincludedintheJSPwiththeHTMLtagsandtheoutputisbeingshownon
thescreen.

Javaapplets

Javaarrays
Javaexception
Javaevents
Javavirtualmachine
Javainputandoutput
JavaURLconnections
Javasockets
JNDI

JavaAWT

Whatisthelifecycleofservlets?

JavadrawingAWTcomponents

Thelifecycleofservletisasfollows:
1.initMethod
initmethodistheinitializationmethodandcalledwhentheservletisfirstcreated.Itisnotcalledoneachuser
request.ItgetsprovokedwhenauserfirstinvokesaURLcorrespondingtotheservletorwhentheserveris
started.Theinitmethodsalsohavedifferenttypes
i.initthattakesnoarguments
publicvoidinit()throwsServletException{
//Initializationcode...
}

Corejava

ii.initthattakesaServletConfig

Servlets

publicvoidinit(ServletConfigconfig)
throwsServletException{
super.init(config)
//Initializationcode...
}

Struts

2.ServiceMethod
Whentheserverreceivesarequestforaservletanewthreadisbeingmadeandaserviceisbeingcalled.This
methodcheckstheHTTPrequesttype(get,post,etc)andcallsoutputtypelikedoget,doput,etc.Thesyntaxisas
follows:
publicvoidservice(HttpServletRequestrequest,
HttpServletResponseresponse)
throwsServletException,IOException{
//ServletCode

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

JDBC
JSP
EJB
J2EE
JNI

Javathreading
J2ME
JMS
Javawebservices
RMI
Internationalization
JavaScript
EJBArchitecture

1/3

2/23/2015

JavainterviewquestionsandanswersPart17
}
3.destroyMethod
Inthisserverdecidetoremovepreviouslyloadedservletinstanceifitidleforaverylongtime.Itcallstheservlets
destroymethodtocloseallthedatabaseconnectionsandperformthecleanupactivities.

WhatisthepurposeofHttpClient?

Spring
JavaTransactionAPIJTA
JBOSS
Javatransactionservices,JTS

HttpClientisaclassthatisusedfornetworkcommunicationbysendingrequiredrequestlineandheaderstothe
webserver.Itplacestherequestlinesinatextareauntilthecommunicationgetlostortheconnectiongetclosed.
TheconnectioncanbeclosedifHttpClientgetsinterruptedbyisInterruptedflag.

JavaGUIFrameworkinterview
SWT/JFaceinterview
MVCandJface

WhySocketUtilisused?

JavaServerFaces

SocketUtilisaclassthatprovidestheutilitytosimplifythecreationofstreamsthatareusedinnetwork
programming.ThisisusedinNetworkClientandHttpClient.Itcontainsthesocketrelatedfunctions.Itsmain
functionistofindunusuedportsandtocheckthattheportsareinuseornot.Itisalsousedtocheckthe
localhostaddress.Thesyntaxcanbe:isLocalhost
publicstaticbooleanisLocalhost(java.lang.Stringhost)
ItchecksthehostnameorIPaddressbylookingforthelocalmachine.

Hibernateinterview

Howtheinterruptiblemethodgetsimplemented?

MIDPinterview

Interruptibleisaninterfacethatisusedtoidentifycertainclasses,whichhaveanisInterruptedmethod.Itisused
byHttpClienttoseetheinterruptiondonebyanyuserorforthewebclient.Itssyntaxisgivenas:

Weblogicinterview

publicinterfaceInterruptible{
publicbooleanisInterrupted()}

Websphereinterview

JAAS
JavaMailinterview
Tomcat

Antinterview

Rubyinterview
jQueryinterview
AspectOrientedProgramming
Javadesignpatterns
Javalocalization

WriteyourcommentShareKnowledgeandExperience

Home| Aboutus | Sitemap| Contactus


Copyright20082015CareerRide.com.Allrightsreserved. Termsofuse |FollowusonFacebook!

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

2/3

2/23/2015

JavainterviewquestionsandanswersPart17
Bookm arkto:

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

3/3

Вам также может понравиться