<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7405002587914840836</id><updated>2011-11-27T15:18:41.531-08:00</updated><category term='Objective Questions'/><category term='FAQ'/><category term='Interview Questions'/><category term='JSP'/><category term='Exceptions'/><category term='Java'/><category term='J2EE'/><category term='OOPS'/><category term='Design Patterns'/><category term='Servlet'/><category term='Eclipse'/><title type='text'>Java J2ee Interview Questions And Answers</title><subtitle type='html'>J2EE, Core Java, Struts, ejb, beans, applets, jdbc,spring,design patterns, web development, web services. frequently asked questions (FAQ's)</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://javaqanda.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://javaqanda.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default?start-index=101&amp;max-results=100'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>175</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7405002587914840836.post-6280054092788410051</id><published>2009-09-08T20:23:00.000-07:00</published><updated>2009-09-08T20:23:00.347-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JSP'/><title type='text'>How does JSP handle run-time exceptions?</title><content type='html'>A:&lt;br /&gt;You can use the errorPage attribute of the page directive to have uncaught run-time exceptions automatically forwarded to an error processing page. For example: redirects the browser to the JSP page error.jsp if an uncaught exception is encountered during request processing. Within error.jsp, if you indicate that it is an error-processing page, via the directive: Throwable object describing the exception may be accessed within the error page via the exception implicit object. Note: You must always use a relative URL as the value for the errorPage attribute.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7405002587914840836-6280054092788410051?l=javaqanda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaqanda.blogspot.com/feeds/6280054092788410051/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7405002587914840836&amp;postID=6280054092788410051' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/6280054092788410051'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/6280054092788410051'/><link rel='alternate' type='text/html' href='http://javaqanda.blogspot.com/2009/09/how-does-jsp-handle-run-time-exceptions.html' title='How does JSP handle run-time exceptions?'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7405002587914840836.post-225669678789422458</id><published>2009-09-07T20:22:00.000-07:00</published><updated>2009-09-07T20:22:00.059-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JSP'/><title type='text'>How can I implement a thread-safe JSP page? What are the advantages and Disadvantages of using it?</title><content type='html'>A:&lt;br /&gt;You can make your JSPs thread-safe by having them implement the SingleThreadModel interface. This is done by adding the directive within your JSP page. With this, instead of a single instance of the servlet generated for your JSP page loaded in memory, you will have N instances of the servlet loaded and initialized, with the service method of each instance effectively synchronized. You can typically control the number of instances (N) that are instantiated for all servlets implementing SingleThreadModel through the admin screen for your JSP engine. More importantly, avoid using the tag for variables. If you do use this tag, then you should set isThreadSafe to true, as mentioned above. Otherwise, all requests to that page will access those variables, causing a nasty race condition. SingleThreadModel is not recommended for normal use. There are many pitfalls, including the example above of not being able to use . You should try really hard to make them thread-safe the old fashioned way: by making them thread-safe .&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7405002587914840836-225669678789422458?l=javaqanda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaqanda.blogspot.com/feeds/225669678789422458/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7405002587914840836&amp;postID=225669678789422458' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/225669678789422458'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/225669678789422458'/><link rel='alternate' type='text/html' href='http://javaqanda.blogspot.com/2009/09/how-can-i-implement-thread-safe-jsp.html' title='How can I implement a thread-safe JSP page? What are the advantages and Disadvantages of using it?'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7405002587914840836.post-1347697632160649775</id><published>2009-09-06T20:22:00.000-07:00</published><updated>2009-09-06T20:22:00.482-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JSP'/><title type='text'>How do I use a scriptlet to initialize a newly instantiated bean?</title><content type='html'>A:&lt;br /&gt;A jsp:useBean action may optionally have a body. If the body is specified, its contents will be automatically invoked when the specified bean is instantiated. Typically, the body will contain scriptlets or jsp:setProperty tags to initialize the newly instantiated bean, although you are not restricted to using those alone.&lt;br /&gt;The following example shows the “today” property of the Foo bean initialized to the current date when it is instantiated. Note that here, we make use of a JSP expression within the jsp:setProperty action.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7405002587914840836-1347697632160649775?l=javaqanda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaqanda.blogspot.com/feeds/1347697632160649775/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7405002587914840836&amp;postID=1347697632160649775' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/1347697632160649775'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/1347697632160649775'/><link rel='alternate' type='text/html' href='http://javaqanda.blogspot.com/2009/09/how-do-i-use-scriptlet-to-initialize.html' title='How do I use a scriptlet to initialize a newly instantiated bean?'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7405002587914840836.post-1176023378838985069</id><published>2009-09-05T20:22:00.000-07:00</published><updated>2009-09-05T20:22:00.628-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JSP'/><title type='text'>What's a better approach for enabling thread-safe servlets and JSPs? SingleThreadModel Interface or Synchronization?</title><content type='html'>A:&lt;br /&gt;Although the SingleThreadModel technique is easy to use, and works well for low volume sites, it does not scale well. If you anticipate your users to increase in the future, you may be better off implementing explicit synchronization for your shared data. The key however, is to effectively minimize the amount of code that is synchronzied so that you take maximum advantage of multithreading.&lt;br /&gt;Also, note that SingleThreadModel is pretty resource intensive from the server\'s perspective. The most serious issue however is when the number of concurrent requests exhaust the servlet instance pool. In that case, all the unserviced requests are queued until something becomes free - which results in poor performance. Since the usage is non-deterministic, it may not help much even if you did add more memory and increased the size of the instance pool.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7405002587914840836-1176023378838985069?l=javaqanda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaqanda.blogspot.com/feeds/1176023378838985069/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7405002587914840836&amp;postID=1176023378838985069' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/1176023378838985069'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/1176023378838985069'/><link rel='alternate' type='text/html' href='http://javaqanda.blogspot.com/2009/09/whats-better-approach-for-enabling.html' title='What&apos;s a better approach for enabling thread-safe servlets and JSPs? SingleThreadModel Interface or Synchronization?'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7405002587914840836.post-4615058318982943183</id><published>2009-09-04T20:21:00.000-07:00</published><updated>2009-09-04T20:21:00.437-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JSP'/><title type='text'>How can I enable session tracking for JSP pages if the browser has disabled cookies?</title><content type='html'>A:&lt;br /&gt;We know that session tracking uses cookies by default to associate a session identifier with a unique user. If the browser does not support cookies, or if cookies are disabled, you can still enable session tracking using URL rewriting. URL rewriting essentially includes the session ID within the link itself as a name/value pair. However, for this to be effective, you need to append the session ID for each and every link that is part of your servlet response. Adding the session ID to a link is greatly simplified by means of of a couple of methods: response.encodeURL() associates a session ID with a given URL, and if you are using redirection, response.encodeRedirectURL() can be used by giving the redirected URL as input. Both encodeURL() and encodeRedirectedURL() first determine whether cookies are supported by the browser; if so, the input URL is returned unchanged since the session ID will be persisted as a cookie. Consider the following example, in which two JSP files, say hello1.jsp and hello2.jsp, interact with each other. Basically, we create a new session within hello1.jsp and place an object within this session. The user can then traverse to hello2.jsp by clicking on the link present within the page. Within hello2.jsp, we simply extract the object that was earlier placed in the session and display its contents. Notice that we invoke the encodeURL() within hello1.jsp on the link used to invoke hello2.jsp; if cookies are disabled, the session ID is automatically appended to the URL, allowing hello2.jsp to still retrieve the session object. Try this example first with cookies enabled. Then disable cookie support, restart the brower, and try again. Each time you should see the maintenance of the session across pages. Do note that to get this example to work with cookies disabled at the browser, your JSP engine has to support URL rewriting.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7405002587914840836-4615058318982943183?l=javaqanda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaqanda.blogspot.com/feeds/4615058318982943183/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7405002587914840836&amp;postID=4615058318982943183' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/4615058318982943183'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/4615058318982943183'/><link rel='alternate' type='text/html' href='http://javaqanda.blogspot.com/2009/09/how-can-i-enable-session-tracking-for.html' title='How can I enable session tracking for JSP pages if the browser has disabled cookies?'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7405002587914840836.post-5637207328881427420</id><published>2009-09-03T20:21:00.000-07:00</published><updated>2009-09-03T20:21:00.678-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JSP'/><title type='text'>What is the difference b/w variable declared inside a declaration part and variable declared in scriplet part?</title><content type='html'>A:&lt;br /&gt;Variable declared inside declaration part is treated as a global variable.that means after convertion jsp file into servlet that variable will be in outside of service method or it will be declared as instance variable.And the scope is available to complete jsp and to complete in the converted servlet class.where as if u declare a variable inside a scriplet that variable will be declared inside a service method and the scope is with in the service method.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7405002587914840836-5637207328881427420?l=javaqanda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaqanda.blogspot.com/feeds/5637207328881427420/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7405002587914840836&amp;postID=5637207328881427420' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/5637207328881427420'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/5637207328881427420'/><link rel='alternate' type='text/html' href='http://javaqanda.blogspot.com/2009/09/what-is-difference-bw-variable-declared.html' title='What is the difference b/w variable declared inside a declaration part and variable declared in scriplet part?'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7405002587914840836.post-8921457074774192441</id><published>2009-09-02T20:20:00.000-07:00</published><updated>2009-09-02T20:20:00.339-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JSP'/><title type='text'>Is there a way to execute a JSP from the comandline or from my own application?</title><content type='html'>A:&lt;br /&gt;There is a little tool called JSPExecutor that allows you to do just that. The developers (Hendrik Schreiber &amp;amp; Peter Rossbach ) aim was not to write a full blown servlet engine, but to provide means to use JSP for generating source code or reports. Therefore most HTTP-specific features (headers, sessions, etc) are not implemented, i.e. no reponseline or header is generated. Nevertheless you can use it to precompile JSP for your website.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7405002587914840836-8921457074774192441?l=javaqanda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaqanda.blogspot.com/feeds/8921457074774192441/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7405002587914840836&amp;postID=8921457074774192441' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/8921457074774192441'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/8921457074774192441'/><link rel='alternate' type='text/html' href='http://javaqanda.blogspot.com/2009/09/is-there-way-to-execute-jsp-from.html' title='Is there a way to execute a JSP from the comandline or from my own application?'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7405002587914840836.post-9180341794054752427</id><published>2009-09-01T20:20:00.000-07:00</published><updated>2009-09-01T20:20:00.191-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Servlet'/><title type='text'>How do I prevent the output of my JSP or Servlet pages from being cached by the browser?</title><content type='html'>A:&lt;br /&gt;You will need to set the appropriate HTTP header attributes to prevent the dynamic content output by the JSP page from being cached by the browser. Just execute the following scriptlet at the beginning of your JSP pages to prevent them from being cached at the browser. You need both the statements to take care of some of the older browser versions.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7405002587914840836-9180341794054752427?l=javaqanda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaqanda.blogspot.com/feeds/9180341794054752427/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7405002587914840836&amp;postID=9180341794054752427' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/9180341794054752427'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/9180341794054752427'/><link rel='alternate' type='text/html' href='http://javaqanda.blogspot.com/2009/09/how-do-i-prevent-output-of-my-jsp-or.html' title='How do I prevent the output of my JSP or Servlet pages from being cached by the browser?'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7405002587914840836.post-3325659499747151874</id><published>2009-08-31T20:19:00.000-07:00</published><updated>2009-08-31T20:19:00.622-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JSP'/><title type='text'>Explain the life-cycle mehtods in JSP</title><content type='html'>?&lt;br /&gt;A:&lt;br /&gt;The generated servlet class for a JSP page implements the HttpJspPage interface of the javax.servlet.jsp package. Http HttpJspPage interface extends the JspPage interface which inturn extends the Servlet interface of the javax.servlet package. the generated servlet class thus implements all the methods of the these three interfaces. The JspPage interface declares only two methods - jspInit() and jspDestroy() that must be implemented by all JSP pages regardless of the client-server protocol. However the JSP specification has provided the HttpJspPage interface specifically for the JSP pages serving HTTP requests. This interface declares one method _jspService(). The jspInit()- The container calls the jspInit() to initialize te servlet instance.It is called before any other method, and is called only once for a servlet instance. The _jspservice()- The container calls the _jspservice() for each request, passing it the request and the response objects. The jspDestroy()- The container calls this when it decides take the instance out of service. It is the last method called in the servlet instance.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7405002587914840836-3325659499747151874?l=javaqanda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaqanda.blogspot.com/feeds/3325659499747151874/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7405002587914840836&amp;postID=3325659499747151874' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/3325659499747151874'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/3325659499747151874'/><link rel='alternate' type='text/html' href='http://javaqanda.blogspot.com/2009/08/explain-life-cycle-mehtods-in-jsp.html' title='Explain the life-cycle mehtods in JSP'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7405002587914840836.post-8183622248140318475</id><published>2009-08-30T20:19:00.000-07:00</published><updated>2009-08-30T20:19:00.152-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JSP'/><title type='text'>What are the different scope valiues for the ?</title><content type='html'>A:&lt;br /&gt;The different scope values for are&lt;br /&gt;1.page 2.request 3.session 4.application&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7405002587914840836-8183622248140318475?l=javaqanda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaqanda.blogspot.com/feeds/8183622248140318475/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7405002587914840836&amp;postID=8183622248140318475' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/8183622248140318475'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/8183622248140318475'/><link rel='alternate' type='text/html' href='http://javaqanda.blogspot.com/2009/08/what-are-different-scope-valiues-for.html' title='What are the different scope valiues for the ?'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7405002587914840836.post-2757043260082328947</id><published>2009-08-29T20:18:00.000-07:00</published><updated>2009-08-29T20:18:00.670-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JSP'/><title type='text'>Difference between forward and sendRedirect?</title><content type='html'>A:&lt;br /&gt;When you invoke a forward request, the request is sent to another resource on the server, without the client being informed that a different resource is going to process the request. This process occurs completly with in the web container. When a sendRedirtect method is invoked, it causes the web container to return to the browser indicating that a new URL should be requested. Because the browser issues a completly new request any object that are stored as request attributes before the redirect occurs will be lost. This extra round trip a redirect is slower than forward.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7405002587914840836-2757043260082328947?l=javaqanda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaqanda.blogspot.com/feeds/2757043260082328947/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7405002587914840836&amp;postID=2757043260082328947' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/2757043260082328947'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/2757043260082328947'/><link rel='alternate' type='text/html' href='http://javaqanda.blogspot.com/2009/08/difference-between-forward-and.html' title='Difference between forward and sendRedirect?'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7405002587914840836.post-4554185799217189881</id><published>2009-08-28T20:18:00.000-07:00</published><updated>2009-08-28T20:18:00.356-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JSP'/><title type='text'>What are implicit objects? List them?</title><content type='html'>A:&lt;br /&gt;Certain objects that are available for the use in JSP documents without being declared first. These objects are parsed by the JSP engine and inserted into the generated servlet. The implicit objects re listed below&lt;br /&gt;request&lt;br /&gt;response&lt;br /&gt;pageContext&lt;br /&gt;session&lt;br /&gt;application&lt;br /&gt;out&lt;br /&gt;config&lt;br /&gt;page&lt;br /&gt;exception&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7405002587914840836-4554185799217189881?l=javaqanda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaqanda.blogspot.com/feeds/4554185799217189881/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7405002587914840836&amp;postID=4554185799217189881' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/4554185799217189881'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/4554185799217189881'/><link rel='alternate' type='text/html' href='http://javaqanda.blogspot.com/2009/08/what-are-implicit-objects-list-them.html' title='What are implicit objects? List them?'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7405002587914840836.post-1953539425441371316</id><published>2009-08-27T20:18:00.000-07:00</published><updated>2009-08-27T20:18:00.076-07:00</updated><title type='text'>What is a Scriptlet?</title><content type='html'>A:&lt;br /&gt;A scriptlet can contain any number of language statements, variable or method declarations, or expressions that are valid in the page scripting language.Within scriptlet tags, you can&lt;br /&gt;1.Declare variables or methods to use later in the file (see also Declaration). 2.Write expressions valid in the page scripting language (see also Expression). 3.Use any of the JSP implicit objects or any object declared with a tag. You must write plain text, HTML-encoded text, or other JSP tags outside the scriptlet.&lt;br /&gt;Scriptlets are executed at request time, when the JSP engine processes the client request. If the scriptlet produces output, the output is stored in the out object, from which you can display it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7405002587914840836-1953539425441371316?l=javaqanda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaqanda.blogspot.com/feeds/1953539425441371316/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7405002587914840836&amp;postID=1953539425441371316' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/1953539425441371316'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/1953539425441371316'/><link rel='alternate' type='text/html' href='http://javaqanda.blogspot.com/2009/08/what-is-scriptlet.html' title='What is a Scriptlet?'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7405002587914840836.post-6317312478446741071</id><published>2009-08-27T20:17:00.000-07:00</published><updated>2009-08-27T20:17:00.189-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JSP'/><title type='text'>What is a Declaration?</title><content type='html'>A:&lt;br /&gt;A declaration declares one or more variables or methods for use later in the JSP source file.&lt;br /&gt;A declaration must contain at least one complete declarative statement. You can declare any number of variables or methods within one declaration tag, as long as they are separated by semicolons. The declaration must be valid in the scripting language used in the JSP file.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7405002587914840836-6317312478446741071?l=javaqanda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaqanda.blogspot.com/feeds/6317312478446741071/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7405002587914840836&amp;postID=6317312478446741071' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/6317312478446741071'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/6317312478446741071'/><link rel='alternate' type='text/html' href='http://javaqanda.blogspot.com/2009/08/what-is-declaration.html' title='What is a Declaration?'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7405002587914840836.post-1909052600023951095</id><published>2009-08-26T20:17:00.000-07:00</published><updated>2009-08-26T20:17:00.679-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JSP'/><title type='text'>What is a Expression?</title><content type='html'>A:&lt;br /&gt;An expression tag contains a scripting language expression that is evaluated, converted to a String, and inserted where the expression appears in the JSP file. Because the value of an expression is converted to a String, you can use an expression within text in a JSP file. Like You cannot use a semicolon to end an expression&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7405002587914840836-1909052600023951095?l=javaqanda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaqanda.blogspot.com/feeds/1909052600023951095/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7405002587914840836&amp;postID=1909052600023951095' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/1909052600023951095'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/1909052600023951095'/><link rel='alternate' type='text/html' href='http://javaqanda.blogspot.com/2009/08/what-is-expression.html' title='What is a Expression?'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7405002587914840836.post-3976067909843885041</id><published>2009-08-25T20:17:00.000-07:00</published><updated>2009-08-25T20:17:00.637-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JSP'/><title type='text'>What is a Hidden Comment?</title><content type='html'>A:&lt;br /&gt;A comments that documents the JSP page but is not sent to the client. The JSP engine ignores a hidden comment, and does not process any code within hidden comment tags. A hidden comment is not sent to the client, either in the displayed JSP page or the HTML page source. The hidden comment is useful when you want to hide or "comment out" part of your JSP page.&lt;br /&gt;You can use any characters in the body of the comment except the closing --%&gt; combination. If you need to use --%&gt; in your comment, you can escape it by typing --%\&gt;. JSP Syntax&lt;br /&gt;Examples&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7405002587914840836-3976067909843885041?l=javaqanda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaqanda.blogspot.com/feeds/3976067909843885041/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7405002587914840836&amp;postID=3976067909843885041' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/3976067909843885041'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/3976067909843885041'/><link rel='alternate' type='text/html' href='http://javaqanda.blogspot.com/2009/08/what-is-hidden-comment.html' title='What is a Hidden Comment?'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7405002587914840836.post-5412934316297459759</id><published>2009-08-24T20:15:00.000-07:00</published><updated>2009-08-24T20:15:00.328-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JSP'/><title type='text'>What is a output comment?</title><content type='html'>A:&lt;br /&gt;A comment that is sent to the client in the viewable page source.The JSP engine handles an output comment as uninterpreted HTML text, returning the comment in the HTML output sent to the client. You can see the comment by viewing the page source from your Web browser.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7405002587914840836-5412934316297459759?l=javaqanda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaqanda.blogspot.com/feeds/5412934316297459759/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7405002587914840836&amp;postID=5412934316297459759' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/5412934316297459759'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/5412934316297459759'/><link rel='alternate' type='text/html' href='http://javaqanda.blogspot.com/2009/08/what-is-output-comment.html' title='What is a output comment?'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7405002587914840836.post-3896709046434098381</id><published>2009-08-23T20:15:00.000-07:00</published><updated>2009-08-23T20:15:00.292-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Servlet'/><title type='text'>What is the difference between ServletContext and ServletConfig?</title><content type='html'>A:&lt;br /&gt;ServletContext: Defines a set of methods that a servlet uses to communicate with its servlet container, for example, to get the MIME type of a file, dispatch requests, or write to a log file.The ServletContext object is contained within the ServletConfig object, which the Web server provides the servlet when the servlet is initialized&lt;br /&gt;&lt;br /&gt;ServletConfig: The object created after a servlet is instantiated and its default constructor is read. It is created to pass initialization information to the servlet.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7405002587914840836-3896709046434098381?l=javaqanda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaqanda.blogspot.com/feeds/3896709046434098381/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7405002587914840836&amp;postID=3896709046434098381' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/3896709046434098381'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/3896709046434098381'/><link rel='alternate' type='text/html' href='http://javaqanda.blogspot.com/2009/08/what-is-difference-between_23.html' title='What is the difference between ServletContext and ServletConfig?'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7405002587914840836.post-9035131996667417457</id><published>2009-08-22T20:14:00.000-07:00</published><updated>2009-08-22T20:14:00.126-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Servlet'/><title type='text'>What is the difference between HttpServlet and GenericServlet?</title><content type='html'>A:&lt;br /&gt;A GenericServlet has a service() method aimed to handle requests. HttpServlet extends GenericServlet and adds support for doGet(), doPost(), doHead() methods (HTTP 1.0) plus doPut(), doOptions(), doDelete(), doTrace() methods (HTTP 1.1). Both these classes are abstract.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7405002587914840836-9035131996667417457?l=javaqanda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaqanda.blogspot.com/feeds/9035131996667417457/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7405002587914840836&amp;postID=9035131996667417457' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/9035131996667417457'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/9035131996667417457'/><link rel='alternate' type='text/html' href='http://javaqanda.blogspot.com/2009/08/what-is-difference-between-httpservlet_22.html' title='What is the difference between HttpServlet and GenericServlet?'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7405002587914840836.post-9128268195120797131</id><published>2009-08-21T20:13:00.000-07:00</published><updated>2009-08-21T20:13:00.365-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Servlet'/><title type='text'>What is the difference between Difference between doGet() and doPost()?</title><content type='html'>A:&lt;br /&gt;A doGet() method is limited with 2k of data to be sent, and doPost() method doesn't have this limitation. A request string for doGet() looks like the following: http://www.allapplabs.com/svt1?p1=v1&amp;amp;p2=v2&amp;amp;...&amp;amp;pN=vN doPost() method call doesn't need a long text tail after a servlet name in a request. All parameters are stored in a request itself, not in a request string, and it's impossible to guess the data transmitted to a servlet only looking at a request string.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7405002587914840836-9128268195120797131?l=javaqanda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaqanda.blogspot.com/feeds/9128268195120797131/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7405002587914840836&amp;postID=9128268195120797131' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/9128268195120797131'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/9128268195120797131'/><link rel='alternate' type='text/html' href='http://javaqanda.blogspot.com/2009/08/what-is-difference-between-difference.html' title='What is the difference between Difference between doGet() and doPost()?'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7405002587914840836.post-7248136854484764009</id><published>2009-08-20T19:57:00.000-07:00</published><updated>2009-08-20T19:57:00.170-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Servlet'/><title type='text'>What is preinitialization of a servlet?</title><content type='html'>A:&lt;br /&gt;A container doesnot initialize the servlets ass soon as it starts up, it initializes a servlet when it receives a request for that servlet first time. This is called lazy loading. The servlet specification defines the element, which can be specified in the deployment descriptor to make the servlet container load and initialize the servlet as soon as it starts up. The process of loading a servlet before any request comes in is called preloading or preinitializing a servlet.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7405002587914840836-7248136854484764009?l=javaqanda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaqanda.blogspot.com/feeds/7248136854484764009/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7405002587914840836&amp;postID=7248136854484764009' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/7248136854484764009'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/7248136854484764009'/><link rel='alternate' type='text/html' href='http://javaqanda.blogspot.com/2009/08/what-is-preinitialization-of-servlet.html' title='What is preinitialization of a servlet?'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7405002587914840836.post-4020800524618946002</id><published>2009-08-18T19:56:00.000-07:00</published><updated>2009-08-18T19:56:00.416-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Servlet'/><title type='text'>What are the common mechanisms used for session tracking?</title><content type='html'>What are the common mechanisms used for session tracking?&lt;br /&gt;A:&lt;br /&gt;Cookies SSL sessions URL- rewriting&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7405002587914840836-4020800524618946002?l=javaqanda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaqanda.blogspot.com/feeds/4020800524618946002/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7405002587914840836&amp;postID=4020800524618946002' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/4020800524618946002'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/4020800524618946002'/><link rel='alternate' type='text/html' href='http://javaqanda.blogspot.com/2009/08/what-are-common-mechanisms-used-for.html' title='What are the common mechanisms used for session tracking?'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7405002587914840836.post-6711868273479835186</id><published>2009-08-17T19:56:00.000-07:00</published><updated>2009-08-17T19:56:00.176-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Servlet'/><title type='text'>Explain the directory structure of a web application.</title><content type='html'>A:&lt;br /&gt;The directory structure of a web application consists of two parts. A private directory called WEB-INF A public resource directory which contains public resource folder. WEB-INF folder consists of 1. web.xml 2. classes directory 3. lib directory&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7405002587914840836-6711868273479835186?l=javaqanda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaqanda.blogspot.com/feeds/6711868273479835186/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7405002587914840836&amp;postID=6711868273479835186' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/6711868273479835186'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/6711868273479835186'/><link rel='alternate' type='text/html' href='http://javaqanda.blogspot.com/2009/08/explain-directory-structure-of-web.html' title='Explain the directory structure of a web application.'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7405002587914840836.post-1034512663610091082</id><published>2009-08-16T19:54:00.000-07:00</published><updated>2009-08-16T19:54:00.472-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Servlet'/><title type='text'>What is the difference between the getRequestDispatcher(String path) method of javax.servlet.ServletRequest interface and javax.servlet.ServletContext</title><content type='html'>A:&lt;br /&gt;The getRequestDispatcher(String path) method of javax.servlet.ServletRequest interface accepts parameter the path to the resource to be included or forwarded to, which can be relative to the request of the calling servlet. If the path begins with a "/" it is interpreted as relative to the current context root. The getRequestDispatcher(String path) method of javax.servlet.ServletContext interface cannot accepts relative paths. All path must sart with a "/" and are interpreted as relative to curent context root.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7405002587914840836-1034512663610091082?l=javaqanda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaqanda.blogspot.com/feeds/1034512663610091082/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7405002587914840836&amp;postID=1034512663610091082' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/1034512663610091082'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/1034512663610091082'/><link rel='alternate' type='text/html' href='http://javaqanda.blogspot.com/2009/08/what-is-difference-between.html' title='What is the difference between the getRequestDispatcher(String path) method of javax.servlet.ServletRequest interface and javax.servlet.ServletContext'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7405002587914840836.post-9093546573530533029</id><published>2009-08-15T20:14:00.000-07:00</published><updated>2009-08-15T20:15:13.788-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Servlet'/><title type='text'>What is the difference between HttpServlet and GenericServlet?</title><content type='html'>A:&lt;br /&gt;A GenericServlet has a service() method aimed to handle requests. HttpServlet extends GenericServlet and adds support for doGet(), doPost(), doHead() methods (HTTP 1.0) plus doPut(), doOptions(), doDelete(), doTrace() methods (HTTP 1.1). Both these classes are abstract.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7405002587914840836-9093546573530533029?l=javaqanda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaqanda.blogspot.com/feeds/9093546573530533029/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7405002587914840836&amp;postID=9093546573530533029' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/9093546573530533029'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/9093546573530533029'/><link rel='alternate' type='text/html' href='http://javaqanda.blogspot.com/2009/08/what-is-difference-between-httpservlet.html' title='What is the difference between HttpServlet and GenericServlet?'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7405002587914840836.post-6727509909267538074</id><published>2009-08-15T19:56:00.000-07:00</published><updated>2009-08-15T19:57:24.034-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Servlet'/><title type='text'>Explain ServletContext</title><content type='html'>.&lt;br /&gt;A:&lt;br /&gt;ServletContext interface is a window for a servlet to view it's environment. A servlet can use this interface to get information such as initialization parameters for the web applicationor servlet container's version. Every web application has one and only one ServletContext and is accessible to all active resource of that application.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7405002587914840836-6727509909267538074?l=javaqanda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaqanda.blogspot.com/feeds/6727509909267538074/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7405002587914840836&amp;postID=6727509909267538074' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/6727509909267538074'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/6727509909267538074'/><link rel='alternate' type='text/html' href='http://javaqanda.blogspot.com/2009/08/explain-servletcontext.html' title='Explain ServletContext'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7405002587914840836.post-8260292425530137409</id><published>2009-08-15T19:54:00.000-07:00</published><updated>2009-08-15T19:55:06.247-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Servlet'/><title type='text'>Explain the life cycle methods of a Servlet.</title><content type='html'>The javax.servlet.Servlet interface defines the three methods known as life-cycle method. public void init(ServletConfig config) throws ServletException public void service( ServletRequest req, ServletResponse res) throws ServletException, IOException public void destroy() First the servlet is constructed, then initialized wih the init() method. Any request from client are handled initially by the service() method before delegating to the doXxx() methods in the case of HttpServlet. The servlet is removed from service, destroyed with the destroy() methid, then garbaged collected and finalized.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7405002587914840836-8260292425530137409?l=javaqanda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaqanda.blogspot.com/feeds/8260292425530137409/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7405002587914840836&amp;postID=8260292425530137409' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/8260292425530137409'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/8260292425530137409'/><link rel='alternate' type='text/html' href='http://javaqanda.blogspot.com/2009/08/explain-life-cycle-methods-of-servlet.html' title='Explain the life cycle methods of a Servlet.'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7405002587914840836.post-5065024463298563369</id><published>2009-01-02T03:28:00.001-08:00</published><updated>2009-01-02T03:34:34.239-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Servlet'/><category scheme='http://www.blogger.com/atom/ns#' term='Interview Questions'/><title type='text'>  Servlet Interview Questions </title><content type='html'>&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 12"&gt;&lt;meta name="Originator" content="Microsoft Word 12"&gt;&lt;link rel="File-List" href="file:///D:%5CUSERPR%7E1%5Csshende%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml"&gt;&lt;link rel="themeData" href="file:///D:%5CUSERPR%7E1%5Csshende%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx"&gt;&lt;link rel="colorSchemeMapping" href="file:///D:%5CUSERPR%7E1%5Csshende%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:trackmoves/&gt;   &lt;w:trackformatting/&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:donotpromoteqf/&gt;   &lt;w:lidthemeother&gt;EN-US&lt;/w:LidThemeOther&gt;   &lt;w:lidthemeasian&gt;JA&lt;/w:LidThemeAsian&gt;   &lt;w:lidthemecomplexscript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;    &lt;w:splitpgbreakandparamark/&gt;    &lt;w:dontvertaligncellwithsp/&gt;    &lt;w:dontbreakconstrainedforcedtables/&gt;    &lt;w:dontvertalignintxbx/&gt;    &lt;w:word11kerningpairs/&gt;    &lt;w:cachedcolbalance/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;   &lt;m:mathpr&gt;    &lt;m:mathfont val="Cambria Math"&gt;    &lt;m:brkbin val="before"&gt;    &lt;m:brkbinsub val="&amp;#45;-"&gt;    &lt;m:smallfrac val="off"&gt;    &lt;m:dispdef/&gt;    &lt;m:lmargin val="0"&gt;    &lt;m:rmargin val="0"&gt;    &lt;m:defjc val="centerGroup"&gt;    &lt;m:wrapindent val="1440"&gt;    &lt;m:intlim val="subSup"&gt;    &lt;m:narylim val="undOvr"&gt;   &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" defunhidewhenused="true" defsemihidden="true" defqformat="false" defpriority="99" latentstylecount="267"&gt;   &lt;w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Normal"&gt;   &lt;w:lsdexception locked="false" priority="9" semihidden="false" unhidewhenused="false" qformat="true" name="heading 1"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 2"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 3"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 4"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 5"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 6"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 7"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 8"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 9"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 1"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 2"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 3"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 4"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 5"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 6"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 7"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 8"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 9"&gt;   &lt;w:lsdexception locked="false" priority="35" qformat="true" name="caption"&gt;   &lt;w:lsdexception locked="false" priority="10" semihidden="false" unhidewhenused="false" qformat="true" name="Title"&gt;   &lt;w:lsdexception locked="false" priority="1" name="Default Paragraph Font"&gt;   &lt;w:lsdexception locked="false" priority="0" name="Body Text"&gt;   &lt;w:lsdexception locked="false" priority="11" semihidden="false" unhidewhenused="false" qformat="true" name="Subtitle"&gt;   &lt;w:lsdexception locked="false" priority="0" name="Hyperlink"&gt;   &lt;w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Strong"&gt;   &lt;w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="0" name="Normal (Web)"&gt;   &lt;w:lsdexception locked="false" priority="59" semihidden="false" unhidewhenused="false" name="Table Grid"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Placeholder Text"&gt;   &lt;w:lsdexception locked="false" priority="1" semihidden="false" unhidewhenused="false" qformat="true" name="No Spacing"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Revision"&gt;   &lt;w:lsdexception locked="false" priority="34" semihidden="false" unhidewhenused="false" qformat="true" name="List Paragraph"&gt;   &lt;w:lsdexception locked="false" priority="29" semihidden="false" unhidewhenused="false" qformat="true" name="Quote"&gt;   &lt;w:lsdexception locked="false" priority="30" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Quote"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="19" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="21" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="31" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Reference"&gt;   &lt;w:lsdexception locked="false" priority="32" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Reference"&gt;   &lt;w:lsdexception locked="false" priority="33" semihidden="false" unhidewhenused="false" qformat="true" name="Book Title"&gt;   &lt;w:lsdexception locked="false" priority="37" name="Bibliography"&gt;   &lt;w:lsdexception locked="false" priority="39" qformat="true" name="TOC Heading"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:Wingdings; 	panose-1:5 0 0 0 0 0 0 0 0 0; 	mso-font-charset:2; 	mso-generic-font-family:auto; 	mso-font-pitch:variable; 	mso-font-signature:0 268435456 0 0 -2147483648 0;} @font-face 	{font-family:"Cambria Math"; 	panose-1:2 4 5 3 5 4 6 3 2 4; 	mso-font-charset:1; 	mso-generic-font-family:roman; 	mso-font-format:other; 	mso-font-pitch:variable; 	mso-font-signature:0 0 0 0 0 0;} @font-face 	{font-family:"Arial Unicode MS"; 	panose-1:2 11 6 4 2 2 2 2 2 4; 	mso-font-charset:128; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:-134238209 -371195905 63 0 4129279 0;} @font-face 	{font-family:Verdana; 	panose-1:2 11 6 4 3 5 4 4 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:536871559 0 0 0 415 0;} @font-face 	{font-family:"\@Arial Unicode MS"; 	panose-1:2 11 6 4 2 2 2 2 2 4; 	mso-font-charset:128; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:-134238209 -371195905 63 0 4129279 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman","serif"; 	mso-fareast-font-family:"Times New Roman"; 	mso-fareast-language:EN-US;} p.MsoBodyText, li.MsoBodyText, div.MsoBodyText 	{mso-style-noshow:yes; 	mso-style-unhide:no; 	mso-style-link:"Body Text Char"; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Verdana","sans-serif"; 	mso-fareast-font-family:"Times New Roman"; 	mso-bidi-font-family:"Times New Roman"; 	mso-fareast-language:EN-US;} a:link, span.MsoHyperlink 	{mso-style-noshow:yes; 	mso-style-unhide:no; 	color:blue; 	mso-text-animation:none; 	text-decoration:none; 	text-underline:none; 	text-decoration:none; 	text-line-through:none;} a:visited, span.MsoHyperlinkFollowed 	{mso-style-noshow:yes; 	mso-style-priority:99; 	color:purple; 	mso-themecolor:followedhyperlink; 	text-decoration:underline; 	text-underline:single;} p 	{mso-style-noshow:yes; 	mso-style-unhide:no; 	mso-margin-top-alt:auto; 	margin-right:0in; 	mso-margin-bottom-alt:auto; 	margin-left:0in; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Arial Unicode MS","sans-serif"; 	mso-fareast-language:EN-US;} span.BodyTextChar 	{mso-style-name:"Body Text Char"; 	mso-style-noshow:yes; 	mso-style-unhide:no; 	mso-style-locked:yes; 	mso-style-link:"Body Text"; 	font-family:"Verdana","sans-serif"; 	mso-ascii-font-family:Verdana; 	mso-hansi-font-family:Verdana; 	mso-fareast-language:EN-US;} .MsoChpDefault 	{mso-style-type:export-only; 	mso-default-props:yes; 	font-size:10.0pt; 	mso-ansi-font-size:10.0pt; 	mso-bidi-font-size:10.0pt;} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;}  /* List Definitions */  @list l0 	{mso-list-id:1864514204; 	mso-list-type:hybrid; 	mso-list-template-ids:1814458438 -870521204 168620402 1706211460 519444338 -117520648 -1950308066 1665288774 -604576032 -1282781304;} @list l0:level1 	{mso-level-number-format:bullet; 	mso-level-text:; 	mso-level-tab-stop:.5in; 	mso-level-number-position:left; 	text-indent:-.25in; 	mso-ansi-font-size:10.0pt; 	font-family:Symbol;} ol 	{margin-bottom:0in;} ul 	{margin-bottom:0in;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-priority:99; 	mso-style-qformat:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman","serif";} &lt;/style&gt; &lt;![endif]--&gt;  &lt;div align="center"&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 3pt; width: 5%;" width="5%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 3pt; width: 73%;" width="73%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;div&gt;&lt;br /&gt;&lt;/div&gt;      &lt;div&gt;&lt;br /&gt;&lt;/div&gt;   &lt;p class="MsoNormal" style="margin-bottom: 12pt;"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;div&gt;   &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;    &lt;tbody&gt;&lt;tr&gt;     &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Q:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;     &lt;p&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Explain the life cycle methods of     a Servlet.&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr&gt;     &lt;td style="padding: 0in;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;The     javax.servlet.Servlet interface defines the three methods known as     life-cycle method.&lt;br /&gt;   &lt;strong&gt;&lt;i&gt;&lt;span style=";font-family:&amp;quot;;" &gt;public void     init(ServletConfig config) throws ServletException&lt;/span&gt;&lt;/i&gt;&lt;/strong&gt;&lt;b&gt;&lt;i&gt;&lt;br /&gt;   &lt;strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;public void     service( ServletRequest req, ServletResponse res) throws ServletException,     IOException&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;   &lt;strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;public void     destroy()&lt;/span&gt;&lt;/strong&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;   First the servlet is constructed, then initialized wih the &lt;strong&gt;&lt;i&gt;&lt;span style=";font-family:&amp;quot;;" &gt;init()&lt;/span&gt;&lt;/i&gt;&lt;/strong&gt;     method.&lt;br /&gt;   Any request from client are handled initially by the &lt;strong&gt;&lt;i&gt;&lt;span style=";font-family:&amp;quot;;" &gt;service()&lt;/span&gt;&lt;/i&gt;&lt;/strong&gt;     method before delegating to the &lt;strong&gt;&lt;i&gt;&lt;span style=";font-family:&amp;quot;;" &gt;doXxx()&lt;/span&gt;&lt;/i&gt;&lt;/strong&gt;     methods in the case of HttpServlet.&lt;br /&gt; &lt;br /&gt;   The servlet is removed from service, destroyed with the &lt;strong&gt;&lt;i&gt;&lt;span style=";font-family:&amp;quot;;" &gt;destroy()&lt;/span&gt;&lt;/i&gt;&lt;/strong&gt;     methid, then garbaged collected and finalized.&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style=""&gt;     &lt;td style="padding: 0in;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 35%;" valign="bottom" width="35%"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 62%;" valign="bottom" width="62%"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;    &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;   &lt;/div&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;div&gt;   &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;    &lt;tbody&gt;&lt;tr&gt;     &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Q:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;     &lt;p&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;What is the difference between the     getRequestDispatcher(String path) method of javax.servlet.ServletRequest     interface and javax.servlet.ServletContext interface?&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style="height: 12.75pt;"&gt;     &lt;td style="padding: 0in; height: 12.75pt;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in; height: 12.75pt;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;The     getRequestDispatcher(String path) method of javax.servlet.ServletRequest     interface accepts parameter the path to the resource to be included or     forwarded to, which can be relative to the request of the calling servlet.     If the path begins with a "/" it is interpreted as relative to     the current context root.&lt;br /&gt; &lt;br /&gt;   The getRequestDispatcher(String path) method of     javax.servlet.ServletContext interface cannot accepts relative paths. All     path must sart with a "/" and are interpreted as relative to     curent context root.&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style=""&gt;     &lt;td style="padding: 0in;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 35%;" valign="top" width="35%"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;a href="http://www.allapplabs.com/interview_questions/#top"&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 62%;" valign="top" width="62%"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;    &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;   &lt;/div&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;div&gt;   &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;    &lt;tbody&gt;&lt;tr&gt;     &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Q:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;     &lt;p&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Explain the directory structure of     a web application.&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style="height: 12.75pt;"&gt;     &lt;td style="padding: 0in; height: 12.75pt;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in; height: 12.75pt;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;The     directory structure of a web application consists of two parts.&lt;br /&gt;   A private directory called WEB-INF&lt;br /&gt;   A public resource directory which contains public resource folder.&lt;br /&gt; &lt;br /&gt;   WEB-INF folder consists of&lt;br /&gt;   1. web.xml&lt;br /&gt;   2. classes directory&lt;br /&gt;   3. lib directory&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style=""&gt;     &lt;td style="padding: 0in;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 35%;" valign="top" width="35%"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 62%;" valign="top" width="62%"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;    &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;   &lt;/div&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;div&gt;   &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;    &lt;tbody&gt;&lt;tr&gt;     &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Q:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;     &lt;p&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;What are the common mechanisms     used for session tracking?&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style="height: 12.75pt;"&gt;     &lt;td style="padding: 0in; height: 12.75pt;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in; height: 12.75pt;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Cookies&lt;br /&gt;   SSL sessions&lt;br /&gt;   URL- rewriting&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style=""&gt;     &lt;td style="padding: 0in;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 35%;" valign="top" width="35%"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;a href="http://www.allapplabs.com/interview_questions/#top"&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 62%;" valign="top" width="62%"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;    &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;   &lt;/div&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;div&gt;   &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;    &lt;tbody&gt;&lt;tr&gt;     &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Q:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;     &lt;p&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Explain ServletContext.&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style="height: 12.75pt;"&gt;     &lt;td style="padding: 0in; height: 12.75pt;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in; height: 12.75pt;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;ServletContext     interface is a window for a servlet to view it's environment. A servlet can     use this interface to get information such as initialization parameters for     the web applicationor servlet container's version. Every web application     has one and only one ServletContext and is accessible to all active     resource of that application.&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style=""&gt;     &lt;td style="padding: 0in;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 35%;" valign="top" width="35%"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 62%;" valign="top" width="62%"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;    &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;   &lt;/div&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;div&gt;   &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;    &lt;tbody&gt;&lt;tr&gt;     &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Q:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;     &lt;p&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;What is preinitialization of a     servlet?&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style="height: 13.5pt;"&gt;     &lt;td style="padding: 0in; height: 13.5pt;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in; height: 13.5pt;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A     container doesnot initialize the servlets ass soon as it starts up, it     initializes a servlet when it receives a request for that servlet first     time. This is called lazy loading. The servlet specification defines the     &lt;load-on-startup&gt; element, which can be specified in the deployment     descriptor to make the servlet container load and initialize the servlet as     soon as it starts up. The process of loading a servlet before any request     comes in is called preloading or preinitializing a servlet.&lt;/load-on-startup&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style=""&gt;     &lt;td style="padding: 0in;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 35%;" valign="top" width="35%"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 62%;" valign="top" width="62%"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;    &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;   &lt;/div&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;div&gt;   &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;    &lt;tbody&gt;&lt;tr&gt;     &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Q:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;     &lt;p&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;What is the difference between     Difference between doGet() and doPost()?&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style="height: 13.5pt;"&gt;     &lt;td style="padding: 0in; height: 13.5pt;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in; height: 13.5pt;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A     doGet() method is limited with 2k of data to be sent, and doPost() method     doesn't have this limitation. A request string for doGet() looks like the     following:&lt;br /&gt;   http://www.allapplabs.com/svt1?p1=v1&amp;amp;p2=v2&amp;amp;...&amp;amp;pN=vN&lt;br /&gt;   doPost() method call doesn't need a long text tail after a servlet name in     a request. All parameters are stored in a request itself, not in a request     string, and it's impossible to guess the data transmitted to a servlet only     looking at a request string.&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style=""&gt;     &lt;td style="padding: 0in;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 35%;" valign="top" width="35%"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 62%;" valign="top" width="62%"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;    &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;   &lt;/div&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;div&gt;   &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;    &lt;tbody&gt;&lt;tr&gt;     &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Q:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;     &lt;p&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;What is the difference between     HttpServlet and GenericServlet?&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style="height: 13.5pt;"&gt;     &lt;td style="padding: 0in; height: 13.5pt;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in; height: 13.5pt;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A     GenericServlet has a service() method aimed to handle requests. HttpServlet     extends GenericServlet and adds support for doGet(), doPost(), doHead()     methods (HTTP 1.0) plus doPut(), doOptions(), doDelete(), doTrace() methods     (HTTP 1.1).&lt;br /&gt;   Both these classes are abstract.&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style=""&gt;     &lt;td style="padding: 0in;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 35%;" valign="top" width="35%"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 62%;" valign="top" width="62%"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;    &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;   &lt;/div&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;div&gt;   &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;    &lt;tbody&gt;&lt;tr&gt;     &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Q:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;     &lt;p&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;What is the difference between     ServletContext and ServletConfig?&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style="height: 13.5pt;"&gt;     &lt;td style="padding: 0in; height: 13.5pt;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in; height: 13.5pt;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;ServletContext:     &lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Defines     a set of methods that a servlet uses to communicate with its servlet     container, for example, to get the MIME type of a file, dispatch requests,     or write to a log file.The ServletContext object is contained within the     ServletConfig object, which the Web server provides the servlet when the     servlet is initialized&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;   &lt;br /&gt; &lt;br /&gt;   &lt;/span&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;ServletConfig:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt; The object     created after a servlet is instantiated and its default constructor is     read. It is created to pass initialization information to the servlet. &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style=""&gt;     &lt;td style="padding: 0in;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 56%;" valign="top" width="56%"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;span style="font-size:10;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;    &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;   &lt;/div&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:18;"  &gt;JSP Interview Questions&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:18;"  &gt;(All App Labs)&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 10%;" valign="top" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Question:&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; width: 90%;" valign="top" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q1"&gt;&lt;span style="color: rgb(153, 0, 0);font-size:10;" &gt;What is a output comment?&lt;/span&gt;&lt;/a&gt;    &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Question:&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q2"&gt;&lt;span style="color: rgb(153, 0, 0);font-size:10;" &gt;What is a Hidden comment?&lt;/span&gt;&lt;/a&gt;    &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Question:&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q3"&gt;&lt;span style="color: rgb(153, 0, 0);font-size:10;" &gt;What is an Expression&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;?&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Question:&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q4"&gt;&lt;span style="color: rgb(153, 0, 0);font-size:10;" &gt;What is a Declaration ?&lt;/span&gt;&lt;/a&gt;    &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Question:&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q5"&gt;&lt;span style="color: rgb(153, 0, 0);font-size:10;" &gt;What is a Scriptlet?&lt;/span&gt;&lt;/a&gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Question:&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q6"&gt;&lt;span style="color: rgb(153, 0, 0);font-size:10;" &gt;What are implicit objects? List them?&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Question:&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q7"&gt;&lt;span style="color: rgb(153, 0, 0);font-size:10;" &gt;Difference between forward and   sendRedirect?&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Question:&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q8"&gt;&lt;span style="color: rgb(153, 0, 0);font-size:10;" &gt;What are the different scope values for   the &lt;jsp:usebean&gt;&lt;/jsp:usebean&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;?&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Question:&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q9"&gt;&lt;span style="color: rgb(153, 0, 0);font-size:10;" &gt;Explain the life-cycle methods in JSP&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;?&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Q:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;What is a output comment? &lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A   comment that is sent to the client in the viewable page source.The JSP engine   handles an output comment as uninterpreted HTML text, returning the comment   in the HTML output sent to the client. You can see the comment by viewing the   page source from your Web browser. &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;i&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;JSP   Syntax&lt;/span&gt;&lt;/i&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;br /&gt; &lt;!-- comment [ &lt;%= expression %&gt; ] --&gt;&lt;br /&gt; &lt;b&gt;&lt;i&gt;&lt;br /&gt; &lt;em&gt;&lt;span style=";font-family:&amp;quot;;" &gt;Example 1&lt;/span&gt;&lt;/em&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt; &lt;!-- This is a commnet sent to client on   &lt;%= (new java.util.Date()).toLocaleString() %&gt;&lt;br /&gt;  --&gt;&lt;br /&gt; &lt;b&gt;&lt;i&gt;&lt;br /&gt; &lt;strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;Displays in the page   source:&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt; &lt;/i&gt;&lt;/b&gt;&lt;!-- This is a commnet sent to client on January 24, 2004 --&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in;" valign="bottom"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Q:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; width: 97%;" valign="top" width="97%"&gt;   &lt;p&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;What is a Hidden Comment?&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 48.75pt;"&gt;   &lt;td style="padding: 0in; height: 48.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; height: 48.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A   comments that documents the JSP page but is not sent to the client. The JSP   engine ignores a hidden comment, and does not process any code within hidden   comment tags. A hidden comment is not sent to the client, either in the   displayed JSP page or the HTML page source. The hidden comment is useful when   you want to hide or "comment out" part of your JSP page. &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;You can   use any characters in the body of the comment except the closing --%&gt;   combination. If you need to use --%&gt; in your comment, you can escape it by   typing --%\&gt;. &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;br /&gt; &lt;/span&gt;&lt;em&gt;&lt;b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;JSP Syntax&lt;/span&gt;&lt;/b&gt;&lt;/em&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;br /&gt; &lt;%-- comment --%&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p&gt;&lt;em&gt;&lt;b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Examples&lt;/span&gt;&lt;/b&gt;&lt;/em&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;br /&gt; &lt;%@ page language="java" %&gt;&lt;br /&gt;&lt;br /&gt; &lt;title&gt;A Hidden Comment &lt;/title&gt;&lt;br /&gt;&lt;br /&gt; &lt;%-- This comment will not be visible to the colent in the page source   --%&gt;&lt;br /&gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Q:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; width: 97%;" valign="top" width="97%"&gt;   &lt;p&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;What is a Expression?&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;An   expression tag contains a scripting language expression that is evaluated,   converted to a String, and inserted where the expression appears in the JSP   file. Because the value of an expression is converted to a String, you can   use an expression within text in a JSP file. Like&lt;br /&gt; &lt;%= someexpression %&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt; &lt;br /&gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;%=   (new java.util.Date()).toLocaleString() %&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;You   cannot use a semicolon to end an expression &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Q:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; width: 97%;" valign="top" width="97%"&gt;   &lt;p&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;What is a Declaration&lt;/span&gt;&lt;/strong&gt;&lt;b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;? &lt;/span&gt;&lt;/b&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 0.5in;"&gt;   &lt;td style="padding: 0in; height: 0.5in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; height: 0.5in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A   declaration declares one or more variables or methods for use later in the   JSP source file. &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A declaration   must contain at least one complete declarative statement. You can declare any   number of variables or methods within one declaration tag, as long as they   are separated by semicolons. The declaration must be valid in the scripting   language used in the JSP file.&lt;br /&gt;&lt;br /&gt; &lt;%! somedeclarations %&gt;&lt;br /&gt; &lt;%! int i = 0; %&gt;&lt;br /&gt; &lt;%! int a, b, c; %&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 13.5pt;"&gt;   &lt;td style="padding: 0in; height: 13.5pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in; height: 13.5pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Q:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; width: 97%;" valign="top" width="97%"&gt;   &lt;p&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;What is a Scriptlet? &lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 25.5pt;"&gt;   &lt;td style="padding: 0in; height: 25.5pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; height: 25.5pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A   scriptlet can contain any number of language statements, variable or method   declarations, or expressions that are valid in the page scripting   language.Within scriptlet tags, you can &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;1.Declare   variables or methods to use later in the file (see also Declaration).&lt;br /&gt;&lt;br /&gt; 2.Write expressions valid in the page scripting language (see also   Expression).&lt;br /&gt;&lt;br /&gt; 3.Use any of the JSP implicit objects or any object declared with a   &lt;jsp:usebean&gt; tag.&lt;br /&gt; You must write plain text, HTML-encoded text, or other JSP tags outside the   scriptlet. &lt;/jsp:usebean&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Scriptlets   are executed at request time, when the JSP engine processes the client   request. If the scriptlet produces output, the output is stored in the out   object, from which you can display it.&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 13.5pt;"&gt;   &lt;td style="padding: 0in; height: 13.5pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in; height: 13.5pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Q:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; width: 97%;" valign="top" width="97%"&gt;   &lt;p&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;What are implicit objects? List   them?&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 26.25pt;"&gt;   &lt;td style="padding: 0in; height: 26.25pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; height: 26.25pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Certain   objects that are available for the use in JSP documents without being   declared first. These objects are parsed by the JSP engine and inserted into   the generated servlet. The implicit objects re listed below&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;div&gt;   &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;    &lt;tbody&gt;&lt;tr style=""&gt;     &lt;td style="padding: 0in;" valign="top"&gt;     &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;request&lt;/span&gt;          &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;response&lt;/span&gt;          &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;pageContext&lt;/span&gt;          &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;session&lt;/span&gt;          &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;application&lt;/span&gt;          &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;out&lt;/span&gt;          &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;config&lt;/span&gt;          &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;page&lt;/span&gt;          &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;exception&lt;/span&gt;          &lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;     &lt;/td&gt;    &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;   &lt;/div&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 13.5pt;"&gt;   &lt;td style="padding: 0in; height: 13.5pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in; height: 13.5pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Q:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; width: 97%;" valign="top" width="97%"&gt;   &lt;p&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Difference between forward and   sendRedirect?&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 96.75pt;"&gt;   &lt;td style="padding: 0in; height: 96.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; height: 96.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;When   you invoke a forward request, the request is sent to another resource on the   server, without the client being informed that a different resource is going   to process the request. This process occurs completly with in the web   container. When a sendRedirtect method is invoked, it causes the web   container to return to the browser indicating that a new URL should be   requested. Because the browser issues a completly new request any object that   are stored as request attributes before the redirect occurs will be lost.   This extra round trip a redirect is slower than forward.&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 13.5pt;"&gt;   &lt;td style="padding: 0in; height: 13.5pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in; height: 13.5pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Q:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; width: 97%;" valign="top" width="97%"&gt;   &lt;p&gt;&lt;b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;What   are the different scope valiues for the &lt;jsp:usebean&gt;?&lt;/jsp:usebean&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 14.25pt;"&gt;   &lt;td style="padding: 0in; height: 14.25pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; height: 14.25pt;" valign="top"&gt;   &lt;p&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;The   different scope values for &lt;jsp:usebean&gt; are &lt;/jsp:usebean&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;1.page&lt;br /&gt; 2.request&lt;br /&gt; 3.session&lt;br /&gt; 4.application&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 14.25pt;"&gt;   &lt;td style="padding: 0in; height: 14.25pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in; height: 14.25pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Q:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; width: 97%;" valign="top" width="97%"&gt;   &lt;p&gt;&lt;b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Explain   the life-cycle mehtods in JSP?&lt;/span&gt;&lt;/b&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 13.5pt;"&gt;   &lt;td style="padding: 0in; height: 13.5pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; height: 13.5pt;" valign="top"&gt;   &lt;p&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;The generated   servlet class for a JSP page implements the HttpJspPage interface of the   javax.servlet.jsp package. Http HttpJspPage interface extends the JspPage   interface which inturn extends the Servlet interface of the javax.servlet   package. the generated servlet class thus implements all the methods of the   these three interfaces. The JspPage interface declares only two methods - &lt;em&gt;&lt;span style=";font-family:&amp;quot;;" &gt;jspInit()&lt;/span&gt;&lt;/em&gt;   and&lt;em&gt;&lt;span style=";font-family:&amp;quot;;" &gt; jspDestroy()&lt;/span&gt;&lt;/em&gt; that must be implemented by all   JSP pages regardless of the client-server protocol. However the JSP specification   has provided the HttpJspPage interface specifically for the JSP pages serving   HTTP requests. This interface declares one method &lt;em&gt;&lt;span style=";font-family:&amp;quot;;" &gt;_jspService()&lt;/span&gt;&lt;/em&gt;. &lt;br /&gt; The jspInit()- The container calls the jspInit() to initialize te servlet   instance.It is called before any other method, and is called only once for a   servlet instance.&lt;br /&gt; The _jspservice()- The container calls the _jspservice() for each request,   passing it the request and the response objects.&lt;br /&gt; The jspDestroy()- The container calls this when it decides take the instance   out of service. It is the last method called in the servlet instance.&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 10%;" valign="top" width="10%"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Question:&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; width: 90%;" valign="top" width="90%"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q1"&gt;&lt;span style="color: rgb(153, 0, 0);font-size:10;" &gt;How do I prevent the output of my JSP   or Servlet pages from being cached by the browser? &lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Question:&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q2"&gt;&lt;span style="color: rgb(153, 0, 0);font-size:10;" &gt;How does JSP handle run-time   exceptions? &lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Question:&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q3"&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;How   can I implement a thread-safe JSP page? What are the advantages and   Disadvantages of using it?&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Question:&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q4"&gt;&lt;span style="color: rgb(153, 0, 0);font-size:10;" &gt;How do I use a scriptlet to initialize   a newly instantiated bean?&lt;/span&gt;&lt;/a&gt;  &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Question:&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q5"&gt;&lt;span style="color: rgb(153, 0, 0);font-size:10;" &gt;How can I prevent the word   "null" from appearing in my HTML input text fields when I populate   them with a resultset that has null values?&lt;/span&gt;&lt;/a&gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Question:&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q6"&gt;&lt;span style="color: rgb(153, 0, 0);font-size:10;" &gt;What's a better approach for enabling   thread-safe servlets and JSPs? SingleThreadModel Interface or   Synchronization?&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Question:&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q7"&gt;&lt;span style="color: rgb(153, 0, 0);font-size:10;" &gt;How can I enable session tracking for   JSP pages if the browser has disabled cookies?&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 3.24%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Q:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;   &lt;p style="text-align: justify;"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;How   do I prevent the output of my JSP or Servlet pages from being cached by the   browser?&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;You   will need to set the appropriate HTTP header attributes to prevent the   dynamic content output by the JSP page from being cached by the browser. Just   execute the following scriptlet at the beginning of your JSP pages to prevent   them from being cached at the browser. You need both the statements to take   care of some of the older browser versions.&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p style="margin-bottom: 12pt;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;%   response.setHeader("Cache-Control","no-store"); //HTTP   1.1   response.setHeader("Pragma\","no-cache"); //HTTP 1.0   response.setDateHeader ("Expires", 0); //prevents caching at the   proxy server   %&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p style="margin-bottom: 12pt;"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in; width: 3.24%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Q:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;   &lt;p style="text-align: justify;"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;How   does JSP handle run-time exceptions? &lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 48.75pt;"&gt;   &lt;td style="padding: 0in; height: 48.75pt;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="2" style="padding: 0in; height: 48.75pt;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;You can use the errorPage attribute of   the page directive to have uncaught run-time exceptions automatically   forwarded to an error processing page. For example:&lt;br /&gt; &lt;%@ page errorPage=\"error.jsp\" %&gt; redirects the browser to   the JSP page error.jsp if an uncaught exception is encountered during request   processing. Within error.jsp, if you indicate that it is an error-processing   page, via the directive: &lt;%@ page isErrorPage=\"true\" %&gt;   Throwable object describing the exception may be accessed within the error   page via the exception implicit object. Note: You must always use a relative   URL as the value for the errorPage attribute.&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in; width: 85.88%;" valign="top" width="85%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in; width: 10.88%;" valign="top" width="10%"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Q:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;   &lt;p style="text-align: justify;"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;How   can I implement a thread-safe JSP page? What are the advantages and   Disadvantages of using it?&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;You can make your JSPs thread-safe by   having them implement the SingleThreadModel interface. This is done by adding   the directive &lt;%@ page isThreadSafe="false" %&gt; within your   JSP page. With this, instead of a single instance of the servlet generated   for your JSP page loaded in memory, you will have N instances of the servlet   loaded and initialized, with the service method of each instance effectively   synchronized. You can typically control the number of instances (N) that are   instantiated for all servlets implementing SingleThreadModel through the   admin screen for your JSP engine. More importantly, avoid using the tag for   variables. If you do use this tag, then you should set isThreadSafe to true,   as mentioned above. Otherwise, all requests to that page will access those   variables, causing a nasty race condition. SingleThreadModel is not   recommended for normal use. There are many pitfalls, including the example   above of not being able to use &lt;%! %&gt;. You should try really hard to   make them thread-safe the old fashioned way: by making them thread-safe .&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style=";font-family:&amp;quot;;" &gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in; width: 85%;" valign="top" width="85%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in; width: 12%;" valign="top" width="12%"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Q:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;   &lt;p style="text-align: justify;"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;How   do I use a scriptlet to initialize a newly instantiated bean?&lt;/span&gt;&lt;/strong&gt;&lt;b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt; &lt;/span&gt;&lt;/b&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 0.5in;"&gt;   &lt;td style="padding: 0in; height: 0.5in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="2" style="padding: 0in; height: 0.5in;" valign="top"&gt;   &lt;p&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A   jsp:useBean action may optionally have a body. If the body is specified, its   contents will be automatically invoked when the specified bean is   instantiated. Typically, the body will contain scriptlets or jsp:setProperty   tags to initialize the newly instantiated bean, although you are not   restricted to using those alone.&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;The   following example shows the “today” property of the Foo bean initialized to   the current date when it is instantiated. Note that here, we make use of a   JSP expression within the jsp:setProperty action.&lt;br /&gt;&lt;br /&gt; &lt;jsp:usebean id="foo" class="com.Bar.Foo"&gt; &lt;/jsp:usebean&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;jsp:setproperty name="foo" property="today" value=""&gt;"&gt;&lt;/jsp:setproperty&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;%--   scriptlets calling bean setter methods go here --%&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p style="margin-bottom: 12pt;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 13.5pt;"&gt;   &lt;td style="padding: 0in; height: 13.5pt;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style=";font-family:&amp;quot;;" &gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in; width: 85%; height: 13.5pt;" valign="top" width="85%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in; width: 12%; height: 13.5pt;" valign="top" width="12%"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 3.24%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Q:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;   &lt;p style="text-align: justify;"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;How   can I prevent the word "null" from appearing in my HTML input text   fields when I populate them with a resultset that has null values? &lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 25.5pt;"&gt;   &lt;td style="padding: 0in; height: 25.5pt;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="2" style="padding: 0in; height: 25.5pt;" valign="top"&gt;   &lt;p&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;You   could make a simple wrapper function, like &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;%!   String blanknull(String s) {   return (s == null) ? \"\" : s;   }   %&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;then use   it inside your JSP form, like&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p style="margin-bottom: 12pt;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;input name="lastName" value="" type="text"&gt;"   &gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in; width: 3.24%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Q:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;   &lt;p style="text-align: justify;"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;What's   a better approach for enabling thread-safe servlets and JSPs? SingleThreadModel   Interface or Synchronization?&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 26.25pt;"&gt;   &lt;td style="padding: 0in; height: 26.25pt;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="2" style="padding: 0in; height: 26.25pt;" valign="top"&gt;   &lt;p class="MsoBodyText"&gt;Although the SingleThreadModel technique is easy to use,   and works well for low volume sites, it does not scale well. If you   anticipate your users to increase in the future, you may be better off   implementing explicit synchronization for your shared data. The key however,   is to effectively minimize the amount of code that is synchronzied so that   you take maximum advantage of multithreading. &lt;/p&gt;   &lt;p style="margin-bottom: 12pt;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Also, note that SingleThreadModel is pretty resource   intensive from the server\'s perspective. The most serious issue however is   when the number of concurrent requests exhaust the servlet instance pool. In   that case, all the unserviced requests are queued until something becomes   free - which results in poor performance. Since the usage is   non-deterministic, it may not help much even if you did add more memory and   increased the size of the instance pool.&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;   &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 13.5pt;"&gt;   &lt;td style="padding: 0in; height: 13.5pt;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style=";font-family:&amp;quot;;" &gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in; width: 84.88%; height: 13.5pt;" valign="top" width="84%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in; width: 11.88%; height: 13.5pt;" valign="top" width="11%"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Q:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p style="text-align: justify;"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;How   can I enable session tracking for JSP pages if the browser has disabled   cookies?&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 96.75pt;"&gt;   &lt;td style="padding: 0in; height: 96.75pt;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; height: 96.75pt;" valign="top"&gt;   &lt;p class="MsoBodyText"&gt;We know that session tracking uses cookies by default to   associate a session identifier with a unique user. If the browser does not   support cookies, or if cookies are disabled, you can still enable session   tracking using URL rewriting. URL rewriting essentially includes the session   ID within the link itself as a name/value pair. However, for this to be   effective, you need to append the session ID for each and every link that is   part of your servlet response. Adding the session ID to a link is greatly   simplified by means of of a couple of methods: response.encodeURL()   associates a session ID with a given URL, and if you are using redirection,   response.encodeRedirectURL() can be used by giving the redirected URL as   input. Both encodeURL() and encodeRedirectedURL() first determine whether   cookies are supported by the browser; if so, the input URL is returned   unchanged since the session ID will be persisted as a cookie.&lt;br /&gt;&lt;br /&gt; Consider the following example, in which two JSP files, say hello1.jsp and   hello2.jsp, interact with each other. Basically, we create a new session   within hello1.jsp and place an object within this session. The user can then   traverse to hello2.jsp by clicking on the link present within the page.   Within hello2.jsp, we simply extract the object that was earlier placed in   the session and display its contents. Notice that we invoke the encodeURL()   within hello1.jsp on the link used to invoke hello2.jsp; if cookies are   disabled, the session ID is automatically appended to the URL, allowing   hello2.jsp to still retrieve the session object. Try this example first with   cookies enabled. Then disable cookie support, restart the brower, and try   again. Each time you should see the maintenance of the session across pages.   Do note that to get this example to work with cookies disabled at the   browser, your JSP engine has to support URL rewriting. &lt;/p&gt;   &lt;p&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;hello1.jsp&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;%@   page session=\"true\" %&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;%&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Integer   num = new Integer(100);&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;session.putValue("num",num);&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;String   url =response.encodeURL("hello2.jsp");&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;%&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;a href="http://www.blogger.com/%5C%27%3C%="&gt;\'&gt;hello2.jsp&lt;/a&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;hello2.jsp&lt;/span&gt;&lt;/strong&gt;&lt;b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;br /&gt; &lt;/span&gt;&lt;/b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;%@   page session="true" %&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;%   Integer i= (Integer )session.getValue("num");   out.println("Num value in session is " + i.intValue());   %&gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 11.64%;" valign="top" width="11%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Question:&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; width: 88.36%;" valign="top" width="88%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q1"&gt;&lt;span style="color: rgb(153, 0, 0);font-size:10;" &gt;What is the difference between   variable declared inside a declaration part and variable declared in scriplet   part?&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Question:&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q7"&gt;&lt;span style="color: rgb(153, 0, 0);font-size:10;" &gt;Is there a way to execute a JSP from   the comandline or from my own application?&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Q:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;   &lt;p&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;What is the difference b/w variable   declared inside a declaration part and variable declared in scriplet part?&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Variable   declared inside declaration part is treated as a global variable.that means   after convertion jsp file into servlet that variable will be in outside of   service method or it will be declared as instance variable.And the scope is   available to complete jsp and to complete in the converted servlet   class.where as if u declare a variable inside a scriplet that variable will   be declared inside a service method and the scope is with in the service   method. &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in; width: 86%;" valign="bottom" width="86%"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in; width: 11%;" valign="bottom" width="11%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Q:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Is there a way to execute a JSP from   the comandline or from my own application?&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 63.75pt;"&gt;   &lt;td style="padding: 0in; height: 63.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;A:&lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; height: 63.75pt;" valign="top"&gt;   &lt;p&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;There is   a little tool called JSPExecutor that allows you to do just that. The   developers (Hendrik Schreiber &lt;hs@webapp.de&gt; &amp;amp; Peter Rossbach   &lt;pr@webapp.de&gt;) aim was not to write a full blown servlet engine, but   to provide means to use JSP for generating source code or reports. Therefore   most HTTP-specific features (headers, sessions, etc) are not implemented,   i.e. no reponseline or header is generated. Nevertheless you can use it to   precompile JSP for your website. &lt;/pr@webapp.de&gt;&lt;/hs@webapp.de&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7405002587914840836-5065024463298563369?l=javaqanda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaqanda.blogspot.com/feeds/5065024463298563369/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7405002587914840836&amp;postID=5065024463298563369' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/5065024463298563369'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/5065024463298563369'/><link rel='alternate' type='text/html' href='http://javaqanda.blogspot.com/2009/01/servlet-interview-questions.html' title='  Servlet Interview Questions '/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7405002587914840836.post-6522581271919339047</id><published>2009-01-02T03:28:00.000-08:00</published><updated>2009-08-15T19:53:34.911-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Servlet'/><category scheme='http://www.blogger.com/atom/ns#' term='Interview Questions'/><title type='text'>  Servlet Interview Questions </title><content type='html'>&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 12"&gt;&lt;meta name="Originator" content="Microsoft Word 12"&gt;&lt;link rel="File-List" href="file:///D:%5CUSERPR%7E1%5Csshende%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml"&gt;&lt;link rel="themeData" href="file:///D:%5CUSERPR%7E1%5Csshende%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx"&gt;&lt;link rel="colorSchemeMapping" href="file:///D:%5CUSERPR%7E1%5Csshende%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:trackmoves/&gt;   &lt;w:trackformatting/&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:donotpromoteqf/&gt;   &lt;w:lidthemeother&gt;EN-US&lt;/w:LidThemeOther&gt;   &lt;w:lidthemeasian&gt;JA&lt;/w:LidThemeAsian&gt;   &lt;w:lidthemecomplexscript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;    &lt;w:splitpgbreakandparamark/&gt;    &lt;w:dontvertaligncellwithsp/&gt;    &lt;w:dontbreakconstrainedforcedtables/&gt;    &lt;w:dontvertalignintxbx/&gt;    &lt;w:word11kerningpairs/&gt;    &lt;w:cachedcolbalance/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;   &lt;m:mathpr&gt;    &lt;m:mathfont val="Cambria Math"&gt;    &lt;m:brkbin val="before"&gt;    &lt;m:brkbinsub val="&amp;#45;-"&gt;    &lt;m:smallfrac val="off"&gt;    &lt;m:dispdef/&gt;    &lt;m:lmargin val="0"&gt;    &lt;m:rmargin val="0"&gt;    &lt;m:defjc val="centerGroup"&gt;    &lt;m:wrapindent val="1440"&gt;    &lt;m:intlim val="subSup"&gt;    &lt;m:narylim val="undOvr"&gt;   &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" defunhidewhenused="true" defsemihidden="true" defqformat="false" defpriority="99" latentstylecount="267"&gt;   &lt;w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Normal"&gt;   &lt;w:lsdexception locked="false" priority="9" semihidden="false" unhidewhenused="false" qformat="true" name="heading 1"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 2"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 3"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 4"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 5"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 6"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 7"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 8"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 9"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 1"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 2"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 3"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 4"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 5"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 6"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 7"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 8"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 9"&gt;   &lt;w:lsdexception locked="false" priority="35" qformat="true" name="caption"&gt;   &lt;w:lsdexception locked="false" priority="10" semihidden="false" unhidewhenused="false" qformat="true" name="Title"&gt;   &lt;w:lsdexception locked="false" priority="1" name="Default Paragraph Font"&gt;   &lt;w:lsdexception locked="false" priority="0" name="Body Text"&gt;   &lt;w:lsdexception locked="false" priority="11" semihidden="false" unhidewhenused="false" qformat="true" name="Subtitle"&gt;   &lt;w:lsdexception locked="false" priority="0" name="Hyperlink"&gt;   &lt;w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Strong"&gt;   &lt;w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="0" name="Normal (Web)"&gt;   &lt;w:lsdexception locked="false" priority="59" semihidden="false" unhidewhenused="false" name="Table Grid"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Placeholder Text"&gt;   &lt;w:lsdexception locked="false" priority="1" semihidden="false" unhidewhenused="false" qformat="true" name="No Spacing"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Revision"&gt;   &lt;w:lsdexception locked="false" priority="34" semihidden="false" unhidewhenused="false" qformat="true" name="List Paragraph"&gt;   &lt;w:lsdexception locked="false" priority="29" semihidden="false" unhidewhenused="false" qformat="true" name="Quote"&gt;   &lt;w:lsdexception locked="false" priority="30" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Quote"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="19" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="21" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="31" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Reference"&gt;   &lt;w:lsdexception locked="false" priority="32" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Reference"&gt;   &lt;w:lsdexception locked="false" priority="33" semihidden="false" unhidewhenused="false" qformat="true" name="Book Title"&gt;   &lt;w:lsdexception locked="false" priority="37" name="Bibliography"&gt;   &lt;w:lsdexception locked="false" priority="39" qformat="true" name="TOC Heading"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:Wingdings; 	panose-1:5 0 0 0 0 0 0 0 0 0; 	mso-font-charset:2; 	mso-generic-font-family:auto; 	mso-font-pitch:variable; 	mso-font-signature:0 268435456 0 0 -2147483648 0;} @font-face 	{font-family:"Cambria Math"; 	panose-1:2 4 5 3 5 4 6 3 2 4; 	mso-font-charset:1; 	mso-generic-font-family:roman; 	mso-font-format:other; 	mso-font-pitch:variable; 	mso-font-signature:0 0 0 0 0 0;} @font-face 	{font-family:"Arial Unicode MS"; 	panose-1:2 11 6 4 2 2 2 2 2 4; 	mso-font-charset:128; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:-134238209 -371195905 63 0 4129279 0;} @font-face 	{font-family:Verdana; 	panose-1:2 11 6 4 3 5 4 4 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:536871559 0 0 0 415 0;} @font-face 	{font-family:"\@Arial Unicode MS"; 	panose-1:2 11 6 4 2 2 2 2 2 4; 	mso-font-charset:128; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:-134238209 -371195905 63 0 4129279 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman","serif"; 	mso-fareast-font-family:"Times New Roman"; 	mso-fareast-language:EN-US;} p.MsoBodyText, li.MsoBodyText, div.MsoBodyText 	{mso-style-noshow:yes; 	mso-style-unhide:no; 	mso-style-link:"Body Text Char"; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Verdana","sans-serif"; 	mso-fareast-font-family:"Times New Roman"; 	mso-bidi-font-family:"Times New Roman"; 	mso-fareast-language:EN-US;} a:link, span.MsoHyperlink 	{mso-style-noshow:yes; 	mso-style-unhide:no; 	color:blue; 	mso-text-animation:none; 	text-decoration:none; 	text-underline:none; 	text-decoration:none; 	text-line-through:none;} a:visited, span.MsoHyperlinkFollowed 	{mso-style-noshow:yes; 	mso-style-priority:99; 	color:purple; 	mso-themecolor:followedhyperlink; 	text-decoration:underline; 	text-underline:single;} p 	{mso-style-noshow:yes; 	mso-style-unhide:no; 	mso-margin-top-alt:auto; 	margin-right:0in; 	mso-margin-bottom-alt:auto; 	margin-left:0in; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Arial Unicode MS","sans-serif"; 	mso-fareast-language:EN-US;} span.BodyTextChar 	{mso-style-name:"Body Text Char"; 	mso-style-noshow:yes; 	mso-style-unhide:no; 	mso-style-locked:yes; 	mso-style-link:"Body Text"; 	font-family:"Verdana","sans-serif"; 	mso-ascii-font-family:Verdana; 	mso-hansi-font-family:Verdana; 	mso-fareast-language:EN-US;} .MsoChpDefault 	{mso-style-type:export-only; 	mso-default-props:yes; 	font-size:10.0pt; 	mso-ansi-font-size:10.0pt; 	mso-bidi-font-size:10.0pt;} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;}  /* List Definitions */  @list l0 	{mso-list-id:1864514204; 	mso-list-type:hybrid; 	mso-list-template-ids:1814458438 -870521204 168620402 1706211460 519444338 -117520648 -1950308066 1665288774 -604576032 -1282781304;} @list l0:level1 	{mso-level-number-format:bullet; 	mso-level-text:; 	mso-level-tab-stop:.5in; 	mso-level-number-position:left; 	text-indent:-.25in; 	mso-ansi-font-size:10.0pt; 	font-family:Symbol;} ol 	{margin-bottom:0in;} ul 	{margin-bottom:0in;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-priority:99; 	mso-style-qformat:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman","serif";} &lt;/style&gt; &lt;![endif]--&gt;  &lt;div align="center"&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 3pt; width: 5%;" width="5%"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 3pt; width: 73%;" width="73%"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;div&gt;&lt;br /&gt;&lt;/div&gt;      &lt;div&gt;&lt;br /&gt;&lt;/div&gt;   &lt;p class="MsoNormal" style="margin-bottom: 12pt;"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;div&gt;   &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;    &lt;tbody&gt;&lt;tr&gt;     &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Q:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;     &lt;p&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Explain the life cycle methods of     a Servlet.&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr&gt;     &lt;td style="padding: 0in;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;The     javax.servlet.Servlet interface defines the three methods known as     life-cycle method.&lt;br /&gt;   &lt;strong&gt;&lt;i&gt;&lt;font style="" face="&amp;quot;"&gt;public void     init(ServletConfig config) throws ServletException&lt;/font&gt;&lt;/i&gt;&lt;/strong&gt;&lt;b&gt;&lt;i&gt;&lt;br /&gt;   &lt;strong&gt;&lt;font style="" face="&amp;quot;"&gt;public void     service( ServletRequest req, ServletResponse res) throws ServletException,     IOException&lt;/font&gt;&lt;/strong&gt;&lt;br /&gt;   &lt;strong&gt;&lt;font style="" face="&amp;quot;"&gt;public void     destroy()&lt;/font&gt;&lt;/strong&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;   First the servlet is constructed, then initialized wih the &lt;strong&gt;&lt;i&gt;&lt;font style="" face="&amp;quot;"&gt;init()&lt;/font&gt;&lt;/i&gt;&lt;/strong&gt;     method.&lt;br /&gt;   Any request from client are handled initially by the &lt;strong&gt;&lt;i&gt;&lt;font style="" face="&amp;quot;"&gt;service()&lt;/font&gt;&lt;/i&gt;&lt;/strong&gt;     method before delegating to the &lt;strong&gt;&lt;i&gt;&lt;font style="" face="&amp;quot;"&gt;doXxx()&lt;/font&gt;&lt;/i&gt;&lt;/strong&gt;     methods in the case of HttpServlet.&lt;br /&gt; &lt;br /&gt;   The servlet is removed from service, destroyed with the &lt;strong&gt;&lt;i&gt;&lt;font style="" face="&amp;quot;"&gt;destroy()&lt;/font&gt;&lt;/i&gt;&lt;/strong&gt;     methid, then garbaged collected and finalized.&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style=""&gt;     &lt;td style="padding: 0in;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt; &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 35%;" valign="bottom" width="35%"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 62%;" valign="bottom" width="62%"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;    &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;   &lt;/div&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;div&gt;   &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;    &lt;tbody&gt;&lt;tr&gt;     &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Q:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;     &lt;p&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;What is the difference between the     getRequestDispatcher(String path) method of javax.servlet.ServletRequest     interface and javax.servlet.ServletContext interface?&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style="height: 12.75pt;"&gt;     &lt;td style="padding: 0in; height: 12.75pt;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in; height: 12.75pt;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;The     getRequestDispatcher(String path) method of javax.servlet.ServletRequest     interface accepts parameter the path to the resource to be included or     forwarded to, which can be relative to the request of the calling servlet.     If the path begins with a "/" it is interpreted as relative to     the current context root.&lt;br /&gt; &lt;br /&gt;   The getRequestDispatcher(String path) method of     javax.servlet.ServletContext interface cannot accepts relative paths. All     path must sart with a "/" and are interpreted as relative to     curent context root.&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style=""&gt;     &lt;td style="padding: 0in;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt; &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 35%;" valign="top" width="35%"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;a href="http://www.allapplabs.com/interview_questions/#top"&gt;&lt;/a&gt;&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 62%;" valign="top" width="62%"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;    &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;   &lt;/div&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;div&gt;   &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;    &lt;tbody&gt;&lt;tr&gt;     &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Q:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;     &lt;p&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Explain the directory structure of     a web application.&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style="height: 12.75pt;"&gt;     &lt;td style="padding: 0in; height: 12.75pt;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in; height: 12.75pt;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;The     directory structure of a web application consists of two parts.&lt;br /&gt;   A private directory called WEB-INF&lt;br /&gt;   A public resource directory which contains public resource folder.&lt;br /&gt; &lt;br /&gt;   WEB-INF folder consists of&lt;br /&gt;   1. web.xml&lt;br /&gt;   2. classes directory&lt;br /&gt;   3. lib directory&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style=""&gt;     &lt;td style="padding: 0in;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt; &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 35%;" valign="top" width="35%"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 62%;" valign="top" width="62%"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;    &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;   &lt;/div&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;div&gt;   &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;    &lt;tbody&gt;&lt;tr&gt;     &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Q:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;     &lt;p&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;What are the common mechanisms     used for session tracking?&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style="height: 12.75pt;"&gt;     &lt;td style="padding: 0in; height: 12.75pt;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in; height: 12.75pt;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Cookies&lt;br /&gt;   SSL sessions&lt;br /&gt;   URL- rewriting&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style=""&gt;     &lt;td style="padding: 0in;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt; &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 35%;" valign="top" width="35%"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;a href="http://www.allapplabs.com/interview_questions/#top"&gt;&lt;/a&gt;&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 62%;" valign="top" width="62%"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;    &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;   &lt;/div&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;div&gt;   &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;    &lt;tbody&gt;&lt;tr&gt;     &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Q:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;     &lt;p&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Explain ServletContext.&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style="height: 12.75pt;"&gt;     &lt;td style="padding: 0in; height: 12.75pt;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in; height: 12.75pt;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;ServletContext     interface is a window for a servlet to view it's environment. A servlet can     use this interface to get information such as initialization parameters for     the web applicationor servlet container's version. Every web application     has one and only one ServletContext and is accessible to all active     resource of that application.&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style=""&gt;     &lt;td style="padding: 0in;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt; &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 35%;" valign="top" width="35%"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 62%;" valign="top" width="62%"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;    &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;   &lt;/div&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;div&gt;   &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;    &lt;tbody&gt;&lt;tr&gt;     &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Q:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;     &lt;p&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;What is preinitialization of a     servlet?&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style="height: 13.5pt;"&gt;     &lt;td style="padding: 0in; height: 13.5pt;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in; height: 13.5pt;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A     container doesnot initialize the servlets ass soon as it starts up, it     initializes a servlet when it receives a request for that servlet first     time. This is called lazy loading. The servlet specification defines the     &lt;load-on-startup&gt; element, which can be specified in the deployment     descriptor to make the servlet container load and initialize the servlet as     soon as it starts up. The process of loading a servlet before any request     comes in is called preloading or preinitializing a servlet.&lt;/load-on-startup&gt;&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style=""&gt;     &lt;td style="padding: 0in;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt; &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 35%;" valign="top" width="35%"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 62%;" valign="top" width="62%"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;    &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;   &lt;/div&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;div&gt;   &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;    &lt;tbody&gt;&lt;tr&gt;     &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Q:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;     &lt;p&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;What is the difference between     Difference between doGet() and doPost()?&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style="height: 13.5pt;"&gt;     &lt;td style="padding: 0in; height: 13.5pt;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in; height: 13.5pt;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A     doGet() method is limited with 2k of data to be sent, and doPost() method     doesn't have this limitation. A request string for doGet() looks like the     following:&lt;br /&gt;   http://www.allapplabs.com/svt1?p1=v1&amp;amp;p2=v2&amp;amp;...&amp;amp;pN=vN&lt;br /&gt;   doPost() method call doesn't need a long text tail after a servlet name in     a request. All parameters are stored in a request itself, not in a request     string, and it's impossible to guess the data transmitted to a servlet only     looking at a request string.&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style=""&gt;     &lt;td style="padding: 0in;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt; &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 35%;" valign="top" width="35%"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 62%;" valign="top" width="62%"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;    &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;   &lt;/div&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;div&gt;   &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;    &lt;tbody&gt;&lt;tr&gt;     &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Q:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;     &lt;p&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;What is the difference between     HttpServlet and GenericServlet?&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style="height: 13.5pt;"&gt;     &lt;td style="padding: 0in; height: 13.5pt;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in; height: 13.5pt;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A     GenericServlet has a service() method aimed to handle requests. HttpServlet     extends GenericServlet and adds support for doGet(), doPost(), doHead()     methods (HTTP 1.0) plus doPut(), doOptions(), doDelete(), doTrace() methods     (HTTP 1.1).&lt;br /&gt;   Both these classes are abstract.&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style=""&gt;     &lt;td style="padding: 0in;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt; &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 35%;" valign="top" width="35%"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 62%;" valign="top" width="62%"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;    &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;   &lt;/div&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;div&gt;   &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;    &lt;tbody&gt;&lt;tr&gt;     &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Q:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;     &lt;p&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;What is the difference between     ServletContext and ServletConfig?&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style="height: 13.5pt;"&gt;     &lt;td style="padding: 0in; height: 13.5pt;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;     &lt;td colspan="2" style="padding: 0in; height: 13.5pt;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;ServletContext:     &lt;/font&gt;&lt;/strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Defines     a set of methods that a servlet uses to communicate with its servlet     container, for example, to get the MIME type of a file, dispatch requests,     or write to a log file.The ServletContext object is contained within the     ServletConfig object, which the Web server provides the servlet when the     servlet is initialized&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;   &lt;br /&gt; &lt;br /&gt;   &lt;/font&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;ServletConfig:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt; The object     created after a servlet is instantiated and its default constructor is     read. It is created to pass initialization information to the servlet. &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;     &lt;/td&gt;    &lt;/tr&gt;    &lt;tr style=""&gt;     &lt;td style="padding: 0in;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in; width: 56%;" valign="top" width="56%"&gt;     &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;     &lt;td style="padding: 0in;" valign="top"&gt;     &lt;p class="MsoNormal"&gt;&lt;font size="10"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;    &lt;br /&gt;&lt;/td&gt;    &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;   &lt;/div&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;strong&gt;&lt;font style="" size="18" face="&amp;quot;"&gt;JSP Interview Questions&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;strong&gt;&lt;font style="" size="18" face="&amp;quot;"&gt;(All App Labs)&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 10%;" valign="top" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Question:&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; width: 90%;" valign="top" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q1"&gt;&lt;font style="color: rgb(153, 0, 0);" size="10"&gt;What is a output comment?&lt;/font&gt;&lt;/a&gt;    &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Question:&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q2"&gt;&lt;font style="color: rgb(153, 0, 0);" size="10"&gt;What is a Hidden comment?&lt;/font&gt;&lt;/a&gt;    &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Question:&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q3"&gt;&lt;font style="color: rgb(153, 0, 0);" size="10"&gt;What is an Expression&lt;/font&gt;&lt;/a&gt;&lt;/font&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;?&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Question:&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q4"&gt;&lt;font style="color: rgb(153, 0, 0);" size="10"&gt;What is a Declaration ?&lt;/font&gt;&lt;/a&gt;    &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Question:&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q5"&gt;&lt;font style="color: rgb(153, 0, 0);" size="10"&gt;What is a Scriptlet?&lt;/font&gt;&lt;/a&gt; &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Question:&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q6"&gt;&lt;font style="color: rgb(153, 0, 0);" size="10"&gt;What are implicit objects? List them?&lt;/font&gt;&lt;/a&gt;&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Question:&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q7"&gt;&lt;font style="color: rgb(153, 0, 0);" size="10"&gt;Difference between forward and   sendRedirect?&lt;/font&gt;&lt;/a&gt;&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Question:&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q8"&gt;&lt;font style="color: rgb(153, 0, 0);" size="10"&gt;What are the different scope values for   the &lt;jsp:usebean&gt;&lt;/jsp:usebean&gt;&lt;/font&gt;&lt;/a&gt;&lt;/font&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;?&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Question:&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q9"&gt;&lt;font style="color: rgb(153, 0, 0);" size="10"&gt;Explain the life-cycle methods in JSP&lt;/font&gt;&lt;/a&gt;&lt;/font&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;?&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Q:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;What is a output comment? &lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A   comment that is sent to the client in the viewable page source.The JSP engine   handles an output comment as uninterpreted HTML text, returning the comment   in the HTML output sent to the client. You can see the comment by viewing the   page source from your Web browser. &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;i&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;JSP   Syntax&lt;/font&gt;&lt;/i&gt;&lt;/strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;&lt;br /&gt; &lt;!-- comment [ &lt;%= expression %&gt; ] --&gt;&lt;br /&gt; &lt;b&gt;&lt;i&gt;&lt;br /&gt; &lt;em&gt;&lt;font style="" face="&amp;quot;"&gt;Example 1&lt;/font&gt;&lt;/em&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt; &lt;!-- This is a commnet sent to client on   &lt;%= (new java.util.Date()).toLocaleString() %&gt;&lt;br /&gt;  --&gt;&lt;br /&gt; &lt;b&gt;&lt;i&gt;&lt;br /&gt; &lt;strong&gt;&lt;font style="" face="&amp;quot;"&gt;Displays in the page   source:&lt;/font&gt;&lt;/strong&gt;&lt;br /&gt; &lt;/i&gt;&lt;/b&gt;&lt;!-- This is a commnet sent to client on January 24, 2004 --&gt;&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in;" valign="bottom"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Q:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; width: 97%;" valign="top" width="97%"&gt;   &lt;p&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;What is a Hidden Comment?&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 48.75pt;"&gt;   &lt;td style="padding: 0in; height: 48.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; height: 48.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A   comments that documents the JSP page but is not sent to the client. The JSP   engine ignores a hidden comment, and does not process any code within hidden   comment tags. A hidden comment is not sent to the client, either in the   displayed JSP page or the HTML page source. The hidden comment is useful when   you want to hide or "comment out" part of your JSP page. &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;p&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;You can   use any characters in the body of the comment except the closing --%&gt;   combination. If you need to use --%&gt; in your comment, you can escape it by   typing --%\&gt;. &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;br /&gt; &lt;/font&gt;&lt;em&gt;&lt;b&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;JSP Syntax&lt;/font&gt;&lt;/b&gt;&lt;/em&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;&lt;br /&gt; &lt;%-- comment --%&gt;&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;p&gt;&lt;em&gt;&lt;b&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Examples&lt;/font&gt;&lt;/b&gt;&lt;/em&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;&lt;br /&gt; &lt;%@ page language="java" %&gt;&lt;br /&gt;&lt;br /&gt; &lt;title&gt;A Hidden Comment &lt;/title&gt;&lt;br /&gt;&lt;br /&gt; &lt;%-- This comment will not be visible to the colent in the page source   --%&gt;&lt;br /&gt;&lt;br /&gt; &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Q:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; width: 97%;" valign="top" width="97%"&gt;   &lt;p&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;What is a Expression?&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;An   expression tag contains a scripting language expression that is evaluated,   converted to a String, and inserted where the expression appears in the JSP   file. Because the value of an expression is converted to a String, you can   use an expression within text in a JSP file. Like&lt;br /&gt; &lt;%= someexpression %&gt;&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt; &lt;br /&gt; &lt;/font&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;&lt;%=   (new java.util.Date()).toLocaleString() %&gt;&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;br /&gt; &lt;/font&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;You   cannot use a semicolon to end an expression &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt; &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Q:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; width: 97%;" valign="top" width="97%"&gt;   &lt;p&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;What is a Declaration&lt;/font&gt;&lt;/strong&gt;&lt;b&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;? &lt;/font&gt;&lt;/b&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 0.5in;"&gt;   &lt;td style="padding: 0in; height: 0.5in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; height: 0.5in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A   declaration declares one or more variables or methods for use later in the   JSP source file. &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;p&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A declaration   must contain at least one complete declarative statement. You can declare any   number of variables or methods within one declaration tag, as long as they   are separated by semicolons. The declaration must be valid in the scripting   language used in the JSP file.&lt;br /&gt;&lt;br /&gt; &lt;%! somedeclarations %&gt;&lt;br /&gt; &lt;%! int i = 0; %&gt;&lt;br /&gt; &lt;%! int a, b, c; %&gt;&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 13.5pt;"&gt;   &lt;td style="padding: 0in; height: 13.5pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt; &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in; height: 13.5pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Q:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; width: 97%;" valign="top" width="97%"&gt;   &lt;p&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;What is a Scriptlet? &lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 25.5pt;"&gt;   &lt;td style="padding: 0in; height: 25.5pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; height: 25.5pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A   scriptlet can contain any number of language statements, variable or method   declarations, or expressions that are valid in the page scripting   language.Within scriptlet tags, you can &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;p&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;1.Declare   variables or methods to use later in the file (see also Declaration).&lt;br /&gt;&lt;br /&gt; 2.Write expressions valid in the page scripting language (see also   Expression).&lt;br /&gt;&lt;br /&gt; 3.Use any of the JSP implicit objects or any object declared with a   &lt;jsp:usebean&gt; tag.&lt;br /&gt; You must write plain text, HTML-encoded text, or other JSP tags outside the   scriptlet. &lt;/jsp:usebean&gt;&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;p&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Scriptlets   are executed at request time, when the JSP engine processes the client   request. If the scriptlet produces output, the output is stored in the out   object, from which you can display it.&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 13.5pt;"&gt;   &lt;td style="padding: 0in; height: 13.5pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt; &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in; height: 13.5pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Q:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; width: 97%;" valign="top" width="97%"&gt;   &lt;p&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;What are implicit objects? List   them?&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 26.25pt;"&gt;   &lt;td style="padding: 0in; height: 26.25pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; height: 26.25pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Certain   objects that are available for the use in JSP documents without being   declared first. These objects are parsed by the JSP engine and inserted into   the generated servlet. The implicit objects re listed below&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;div&gt;   &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;    &lt;tbody&gt;&lt;tr style=""&gt;     &lt;td style="padding: 0in;" valign="top"&gt;     &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;request&lt;/font&gt;          &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;response&lt;/font&gt;          &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;pageContext&lt;/font&gt;          &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;session&lt;/font&gt;          &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;application&lt;/font&gt;          &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;out&lt;/font&gt;          &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;config&lt;/font&gt;          &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;page&lt;/font&gt;          &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;exception&lt;/font&gt;          &lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/li&gt;&lt;/ul&gt;     &lt;/td&gt;    &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;   &lt;/div&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 13.5pt;"&gt;   &lt;td style="padding: 0in; height: 13.5pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt; &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in; height: 13.5pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Q:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; width: 97%;" valign="top" width="97%"&gt;   &lt;p&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Difference between forward and   sendRedirect?&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 96.75pt;"&gt;   &lt;td style="padding: 0in; height: 96.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; height: 96.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;When   you invoke a forward request, the request is sent to another resource on the   server, without the client being informed that a different resource is going   to process the request. This process occurs completly with in the web   container. When a sendRedirtect method is invoked, it causes the web   container to return to the browser indicating that a new URL should be   requested. Because the browser issues a completly new request any object that   are stored as request attributes before the redirect occurs will be lost.   This extra round trip a redirect is slower than forward.&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt; &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 13.5pt;"&gt;   &lt;td style="padding: 0in; height: 13.5pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt; &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in; height: 13.5pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Q:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; width: 97%;" valign="top" width="97%"&gt;   &lt;p&gt;&lt;b&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;What   are the different scope valiues for the &lt;jsp:usebean&gt;?&lt;/jsp:usebean&gt;&lt;/font&gt;&lt;/b&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 14.25pt;"&gt;   &lt;td style="padding: 0in; height: 14.25pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; height: 14.25pt;" valign="top"&gt;   &lt;p&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;The   different scope values for &lt;jsp:usebean&gt; are &lt;/jsp:usebean&gt;&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;p&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;1.page&lt;br /&gt; 2.request&lt;br /&gt; 3.session&lt;br /&gt; 4.application&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 14.25pt;"&gt;   &lt;td style="padding: 0in; height: 14.25pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt; &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in; height: 14.25pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Q:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; width: 97%;" valign="top" width="97%"&gt;   &lt;p&gt;&lt;b&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Explain   the life-cycle mehtods in JSP?&lt;/font&gt;&lt;/b&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 13.5pt;"&gt;   &lt;td style="padding: 0in; height: 13.5pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; height: 13.5pt;" valign="top"&gt;   &lt;p&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;The generated   servlet class for a JSP page implements the HttpJspPage interface of the   javax.servlet.jsp package. Http HttpJspPage interface extends the JspPage   interface which inturn extends the Servlet interface of the javax.servlet   package. the generated servlet class thus implements all the methods of the   these three interfaces. The JspPage interface declares only two methods - &lt;em&gt;&lt;font style="" face="&amp;quot;"&gt;jspInit()&lt;/font&gt;&lt;/em&gt;   and&lt;em&gt;&lt;font style="" face="&amp;quot;"&gt; jspDestroy()&lt;/font&gt;&lt;/em&gt; that must be implemented by all   JSP pages regardless of the client-server protocol. However the JSP specification   has provided the HttpJspPage interface specifically for the JSP pages serving   HTTP requests. This interface declares one method &lt;em&gt;&lt;font style="" face="&amp;quot;"&gt;_jspService()&lt;/font&gt;&lt;/em&gt;. &lt;br /&gt; The jspInit()- The container calls the jspInit() to initialize te servlet   instance.It is called before any other method, and is called only once for a   servlet instance.&lt;br /&gt; The _jspservice()- The container calls the _jspservice() for each request,   passing it the request and the response objects.&lt;br /&gt; The jspDestroy()- The container calls this when it decides take the instance   out of service. It is the last method called in the servlet instance.&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 10%;" valign="top" width="10%"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Question:&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; width: 90%;" valign="top" width="90%"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q1"&gt;&lt;font style="color: rgb(153, 0, 0);" size="10"&gt;How do I prevent the output of my JSP   or Servlet pages from being cached by the browser? &lt;/font&gt;&lt;/a&gt;&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Question:&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q2"&gt;&lt;font style="color: rgb(153, 0, 0);" size="10"&gt;How does JSP handle run-time   exceptions? &lt;/font&gt;&lt;/a&gt;&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Question:&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q3"&gt;&lt;/a&gt;&lt;/font&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;How   can I implement a thread-safe JSP page? What are the advantages and   Disadvantages of using it?&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Question:&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q4"&gt;&lt;font style="color: rgb(153, 0, 0);" size="10"&gt;How do I use a scriptlet to initialize   a newly instantiated bean?&lt;/font&gt;&lt;/a&gt;  &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Question:&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q5"&gt;&lt;font style="color: rgb(153, 0, 0);" size="10"&gt;How can I prevent the word   "null" from appearing in my HTML input text fields when I populate   them with a resultset that has null values?&lt;/font&gt;&lt;/a&gt; &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Question:&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q6"&gt;&lt;font style="color: rgb(153, 0, 0);" size="10"&gt;What's a better approach for enabling   thread-safe servlets and JSPs? SingleThreadModel Interface or   Synchronization?&lt;/font&gt;&lt;/a&gt;&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Question:&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q7"&gt;&lt;font style="color: rgb(153, 0, 0);" size="10"&gt;How can I enable session tracking for   JSP pages if the browser has disabled cookies?&lt;/font&gt;&lt;/a&gt;&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 3.24%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Q:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;   &lt;p style="text-align: justify;"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;How   do I prevent the output of my JSP or Servlet pages from being cached by the   browser?&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;You   will need to set the appropriate HTTP header attributes to prevent the   dynamic content output by the JSP page from being cached by the browser. Just   execute the following scriptlet at the beginning of your JSP pages to prevent   them from being cached at the browser. You need both the statements to take   care of some of the older browser versions.&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;p style="margin-bottom: 12pt;"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;&lt;%   response.setHeader("Cache-Control","no-store"); //HTTP   1.1   response.setHeader("Pragma\","no-cache"); //HTTP 1.0   response.setDateHeader ("Expires", 0); //prevents caching at the   proxy server   %&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;p style="margin-bottom: 12pt;"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in; width: 3.24%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Q:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;   &lt;p style="text-align: justify;"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;How   does JSP handle run-time exceptions? &lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 48.75pt;"&gt;   &lt;td style="padding: 0in; height: 48.75pt;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="2" style="padding: 0in; height: 48.75pt;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;You can use the errorPage attribute of   the page directive to have uncaught run-time exceptions automatically   forwarded to an error processing page. For example:&lt;br /&gt; &lt;%@ page errorPage=\"error.jsp\" %&gt; redirects the browser to   the JSP page error.jsp if an uncaught exception is encountered during request   processing. Within error.jsp, if you indicate that it is an error-processing   page, via the directive: &lt;%@ page isErrorPage=\"true\" %&gt;   Throwable object describing the exception may be accessed within the error   page via the exception implicit object. Note: You must always use a relative   URL as the value for the errorPage attribute.&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt; &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in; width: 85.88%;" valign="top" width="85%"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in; width: 10.88%;" valign="top" width="10%"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Q:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;   &lt;p style="text-align: justify;"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;How   can I implement a thread-safe JSP page? What are the advantages and   Disadvantages of using it?&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;You can make your JSPs thread-safe by   having them implement the SingleThreadModel interface. This is done by adding   the directive &lt;%@ page isThreadSafe="false" %&gt; within your   JSP page. With this, instead of a single instance of the servlet generated   for your JSP page loaded in memory, you will have N instances of the servlet   loaded and initialized, with the service method of each instance effectively   synchronized. You can typically control the number of instances (N) that are   instantiated for all servlets implementing SingleThreadModel through the   admin screen for your JSP engine. More importantly, avoid using the tag for   variables. If you do use this tag, then you should set isThreadSafe to true,   as mentioned above. Otherwise, all requests to that page will access those   variables, causing a nasty race condition. SingleThreadModel is not   recommended for normal use. There are many pitfalls, including the example   above of not being able to use &lt;%! %&gt;. You should try really hard to   make them thread-safe the old fashioned way: by making them thread-safe .&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;font style="" face="&amp;quot;"&gt; &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in; width: 85%;" valign="top" width="85%"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in; width: 12%;" valign="top" width="12%"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Q:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;   &lt;p style="text-align: justify;"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;How   do I use a scriptlet to initialize a newly instantiated bean?&lt;/font&gt;&lt;/strong&gt;&lt;b&gt;&lt;font style="" size="10" face="&amp;quot;"&gt; &lt;/font&gt;&lt;/b&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 0.5in;"&gt;   &lt;td style="padding: 0in; height: 0.5in;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="2" style="padding: 0in; height: 0.5in;" valign="top"&gt;   &lt;p&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A   jsp:useBean action may optionally have a body. If the body is specified, its   contents will be automatically invoked when the specified bean is   instantiated. Typically, the body will contain scriptlets or jsp:setProperty   tags to initialize the newly instantiated bean, although you are not   restricted to using those alone.&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;p&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;The   following example shows the “today” property of the Foo bean initialized to   the current date when it is instantiated. Note that here, we make use of a   JSP expression within the jsp:setProperty action.&lt;br /&gt;&lt;br /&gt; &lt;jsp:usebean id="foo" class="com.Bar.Foo"&gt; &lt;/jsp:usebean&gt;&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;p&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;&lt;jsp:setproperty name="foo" property="today" value="&lt;%=java.text.DateFormat.getDateInstance().format(new   java.util.Date()) %&gt;"&gt;&lt;/jsp:setproperty&gt;&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;p&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;&lt;%--   scriptlets calling bean setter methods go here --%&gt;&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;p style="margin-bottom: 12pt;"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt; &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 13.5pt;"&gt;   &lt;td style="padding: 0in; height: 13.5pt;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;font style="" face="&amp;quot;"&gt; &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in; width: 85%; height: 13.5pt;" valign="top" width="85%"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in; width: 12%; height: 13.5pt;" valign="top" width="12%"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 3.24%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Q:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;   &lt;p style="text-align: justify;"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;How   can I prevent the word "null" from appearing in my HTML input text   fields when I populate them with a resultset that has null values? &lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 25.5pt;"&gt;   &lt;td style="padding: 0in; height: 25.5pt;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="2" style="padding: 0in; height: 25.5pt;" valign="top"&gt;   &lt;p&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;You   could make a simple wrapper function, like &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;p&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;&lt;%!   String blanknull(String s) {   return (s == null) ? \"\" : s;   }   %&gt;&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;p&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;then use   it inside your JSP form, like&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;p style="margin-bottom: 12pt;"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;&lt;input name="lastName" value="" type="text"&gt;"   &gt;&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in; width: 3.24%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Q:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;   &lt;p style="text-align: justify;"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;What's   a better approach for enabling thread-safe servlets and JSPs? SingleThreadModel   Interface or Synchronization?&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 26.25pt;"&gt;   &lt;td style="padding: 0in; height: 26.25pt;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="2" style="padding: 0in; height: 26.25pt;" valign="top"&gt;   &lt;p class="MsoBodyText"&gt;Although the SingleThreadModel technique is easy to use,   and works well for low volume sites, it does not scale well. If you   anticipate your users to increase in the future, you may be better off   implementing explicit synchronization for your shared data. The key however,   is to effectively minimize the amount of code that is synchronzied so that   you take maximum advantage of multithreading. &lt;/p&gt;   &lt;p style="margin-bottom: 12pt;"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Also, note that SingleThreadModel is pretty resource   intensive from the server\'s perspective. The most serious issue however is   when the number of concurrent requests exhaust the servlet instance pool. In   that case, all the unserviced requests are queued until something becomes   free - which results in poor performance. Since the usage is   non-deterministic, it may not help much even if you did add more memory and   increased the size of the instance pool.&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;   &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 13.5pt;"&gt;   &lt;td style="padding: 0in; height: 13.5pt;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;font style="" face="&amp;quot;"&gt; &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in; width: 84.88%; height: 13.5pt;" valign="top" width="84%"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in; width: 11.88%; height: 13.5pt;" valign="top" width="11%"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Q:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p style="text-align: justify;"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;How   can I enable session tracking for JSP pages if the browser has disabled   cookies?&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 96.75pt;"&gt;   &lt;td style="padding: 0in; height: 96.75pt;" valign="top"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; height: 96.75pt;" valign="top"&gt;   &lt;p class="MsoBodyText"&gt;We know that session tracking uses cookies by default to   associate a session identifier with a unique user. If the browser does not   support cookies, or if cookies are disabled, you can still enable session   tracking using URL rewriting. URL rewriting essentially includes the session   ID within the link itself as a name/value pair. However, for this to be   effective, you need to append the session ID for each and every link that is   part of your servlet response. Adding the session ID to a link is greatly   simplified by means of of a couple of methods: response.encodeURL()   associates a session ID with a given URL, and if you are using redirection,   response.encodeRedirectURL() can be used by giving the redirected URL as   input. Both encodeURL() and encodeRedirectedURL() first determine whether   cookies are supported by the browser; if so, the input URL is returned   unchanged since the session ID will be persisted as a cookie.&lt;br /&gt;&lt;br /&gt; Consider the following example, in which two JSP files, say hello1.jsp and   hello2.jsp, interact with each other. Basically, we create a new session   within hello1.jsp and place an object within this session. The user can then   traverse to hello2.jsp by clicking on the link present within the page.   Within hello2.jsp, we simply extract the object that was earlier placed in   the session and display its contents. Notice that we invoke the encodeURL()   within hello1.jsp on the link used to invoke hello2.jsp; if cookies are   disabled, the session ID is automatically appended to the URL, allowing   hello2.jsp to still retrieve the session object. Try this example first with   cookies enabled. Then disable cookie support, restart the brower, and try   again. Each time you should see the maintenance of the session across pages.   Do note that to get this example to work with cookies disabled at the   browser, your JSP engine has to support URL rewriting. &lt;/p&gt;   &lt;p&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;hello1.jsp&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;br /&gt; &lt;/font&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;&lt;%@   page session=\"true\" %&gt;&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;br /&gt; &lt;/font&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;&lt;%&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;br /&gt; &lt;/font&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Integer   num = new Integer(100);&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;br /&gt; &lt;/font&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;session.putValue("num",num);&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;br /&gt; &lt;/font&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;String   url =response.encodeURL("hello2.jsp");&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;br /&gt; &lt;/font&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;%&gt;&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;br /&gt; &lt;/font&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;&lt;a href="http://www.blogger.com/%5C%27%3C%="&gt;\'&gt;hello2.jsp&lt;/a&gt;&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;p&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;hello2.jsp&lt;/font&gt;&lt;/strong&gt;&lt;b&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;&lt;br /&gt; &lt;/font&gt;&lt;/b&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;&lt;%@   page session="true" %&gt;&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;br /&gt; &lt;/font&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;&lt;%   Integer i= (Integer )session.getValue("num");   out.println("Num value in session is " + i.intValue());   %&gt; &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 11.64%;" valign="top" width="11%"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Question:&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; width: 88.36%;" valign="top" width="88%"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q1"&gt;&lt;font style="color: rgb(153, 0, 0);" size="10"&gt;What is the difference between   variable declared inside a declaration part and variable declared in scriplet   part?&lt;/font&gt;&lt;/a&gt;&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Question:&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;a href="http://www.allapplabs.com/interview_questions/#q7"&gt;&lt;font style="color: rgb(153, 0, 0);" size="10"&gt;Is there a way to execute a JSP from   the comandline or from my own application?&lt;/font&gt;&lt;/a&gt;&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt; &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt; &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Q:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;   &lt;p&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;What is the difference b/w variable   declared inside a declaration part and variable declared in scriplet part?&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="2" style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Variable   declared inside declaration part is treated as a global variable.that means   after convertion jsp file into servlet that variable will be in outside of   service method or it will be declared as instance variable.And the scope is   available to complete jsp and to complete in the converted servlet   class.where as if u declare a variable inside a scriplet that variable will   be declared inside a service method and the scope is with in the service   method. &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt; &lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in; width: 86%;" valign="bottom" width="86%"&gt;   &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;   &lt;td style="padding: 0in; width: 11%;" valign="bottom" width="11%"&gt;   &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;br /&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td style="padding: 0in; width: 3%;" valign="top" width="3%"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Q:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;Is there a way to execute a JSP from   the comandline or from my own application?&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 63.75pt;"&gt;   &lt;td style="padding: 0in; height: 63.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;A:&lt;/font&gt;&lt;/strong&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in; height: 63.75pt;" valign="top"&gt;   &lt;p&gt;&lt;font style="" size="10" face="&amp;quot;"&gt;There is   a little tool called JSPExecutor that allows you to do just that. The   developers (Hendrik Schreiber &lt;hs@webapp.de&gt; &amp;amp; Peter Rossbach   &lt;pr@webapp.de&gt;) aim was not to write a full blown servlet engine, but   to provide means to use JSP for generating source code or reports. Therefore   most HTTP-specific features (headers, sessions, etc) are not implemented,   i.e. no reponseline or header is generated. Nevertheless you can use it to   precompile JSP for your website. &lt;/pr@webapp.de&gt;&lt;/hs@webapp.de&gt;&lt;/font&gt;&lt;font style="" face="&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7405002587914840836-6522581271919339047?l=javaqanda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaqanda.blogspot.com/feeds/6522581271919339047/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7405002587914840836&amp;postID=6522581271919339047' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/6522581271919339047'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7405002587914840836/posts/default/6522581271919339047'/><link rel='alternate' type='text/html' href='http://javaqanda.blogspot.com/2009/01/servlet-interview-questions_02.html' title='  Servlet Interview Questions '/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7405002587914840836.post-3058500449843394160</id><published>2009-01-02T03:25:00.000-08:00</published><updated>2009-01-02T03:28:14.520-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Design Patterns'/><category scheme='http://www.blogger.com/atom/ns#' term='J2EE'/><title type='text'>JAVA DESIGN PATTERNS</title><content type='html'>&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 12"&gt;&lt;meta name="Originator" content="Microsoft Word 12"&gt;&lt;link rel="File-List" href="file:///D:%5CUSERPR%7E1%5Csshende%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml"&gt;&lt;link rel="themeData" href="file:///D:%5CUSERPR%7E1%5Csshende%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx"&gt;&lt;link rel="colorSchemeMapping" href="file:///D:%5CUSERPR%7E1%5Csshende%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:trackmoves/&gt;   &lt;w:trackformatting/&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:donotpromoteqf/&gt;   &lt;w:lidthemeother&gt;EN-US&lt;/w:LidThemeOther&gt;   &lt;w:lidthemeasian&gt;JA&lt;/w:LidThemeAsian&gt;   &lt;w:lidthemecomplexscript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;    &lt;w:splitpgbreakandparamark/&gt;    &lt;w:dontvertaligncellwithsp/&gt;    &lt;w:dontbreakconstrainedforcedtables/&gt;    &lt;w:dontvertalignintxbx/&gt;    &lt;w:word11kerningpairs/&gt;    &lt;w:cachedcolbalance/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;   &lt;m:mathpr&gt;    &lt;m:mathfont val="Cambria Math"&gt;    &lt;m:brkbin val="before"&gt;    &lt;m:brkbinsub val="&amp;#45;-"&gt;    &lt;m:smallfrac val="off"&gt;    &lt;m:dispdef/&gt;    &lt;m:lmargin val="0"&gt;    &lt;m:rmargin val="0"&gt;    &lt;m:defjc val="centerGroup"&gt;    &lt;m:wrapindent val="1440"&gt;    &lt;m:intlim val="subSup"&gt;    &lt;m:narylim val="undOvr"&gt;   &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" defunhidewhenused="true" defsemihidden="true" defqformat="false" defpriority="99" latentstylecount="267"&gt;   &lt;w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Normal"&gt;   &lt;w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="heading 1"&gt;   &lt;w:lsdexception locked="false" priority="0" qformat="true" name="heading 2"&gt;   &lt;w:lsdexception locked="false" priority="0" qformat="true" name="heading 3"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 4"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 5"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 6"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 7"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 8"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 9"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 1"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 2"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 3"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 4"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 5"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 6"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 7"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 8"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 9"&gt;   &lt;w:lsdexception locked="false" priority="0" qformat="true" name="caption"&gt;   &lt;w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Title"&gt;   &lt;w:lsdexception locked="false" priority="1" name="Default Paragraph Font"&gt;   &lt;w:lsdexception locked="false" priority="0" name="Body Text"&gt;   &lt;w:lsdexception locked="false" priority="11" semihidden="false" unhidewhenused="false" qformat="true" name="Subtitle"&gt;   &lt;w:lsdexception locked="false" priority="0" name="Hyperlink"&gt;   &lt;w:lsdexception locked="false" priority="0" name="FollowedHyperlink"&gt;   &lt;w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Strong"&gt;   &lt;w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="0" name="Normal (Web)"&gt;   &lt;w:lsdexception locked="false" priority="0" name="HTML Code"&gt;   &lt;w:lsdexception locked="false" priority="0" name="HTML Preformatted"&gt;   &lt;w:lsdexception locked="false" priority="0" name="HTML Typewriter"&gt;   &lt;w:lsdexception locked="false" priority="59" semihidden="false" unhidewhenused="false" name="Table Grid"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Placeholder Text"&gt;   &lt;w:lsdexception locked="false" priority="1" semihidden="false" unhidewhenused="false" qformat="true" name="No Spacing"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Revision"&gt;   &lt;w:lsdexception locked="false" priority="34" semihidden="false" unhidewhenused="false" qformat="true" name="List Paragraph"&gt;   &lt;w:lsdexception locked="false" priority="29" semihidden="false" unhidewhenused="false" qformat="true" name="Quote"&gt;   &lt;w:lsdexception locked="false" priority="30" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Quote"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="19" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="21" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="31" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Reference"&gt;   &lt;w:lsdexception locked="false" priority="32" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Reference"&gt;   &lt;w:lsdexception locked="false" priority="33" semihidden="false" unhidewhenused="false" qformat="true" name="Book Title"&gt;   &lt;w:lsdexception locked="false" priority="37" name="Bibliography"&gt;   &lt;w:lsdexception locked="false" priority="39" qformat="true" name="TOC Heading"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:"Cambria Math"; 	panose-1:2 4 5 3 5 4 6 3 2 4; 	mso-font-charset:1; 	mso-generic-font-family:roman; 	mso-font-format:other; 	mso-font-pitch:variable; 	mso-font-signature:0 0 0 0 0 0;} @font-face 	{font-family:"Arial Unicode MS"; 	panose-1:2 11 6 4 2 2 2 2 2 4; 	mso-font-charset:128; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:-134238209 -371195905 63 0 4129279 0;} @font-face 	{font-family:Verdana; 	panose-1:2 11 6 4 3 5 4 4 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:536871559 0 0 0 415 0;} @font-face 	{font-family:"\@Arial Unicode MS"; 	panose-1:2 11 6 4 2 2 2 2 2 4; 	mso-font-charset:128; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:-134238209 -371195905 63 0 4129279 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman","serif"; 	mso-fareast-font-family:"Times New Roman"; 	mso-fareast-language:EN-US;} h1 	{mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-link:"Heading 1 Char"; 	mso-style-next:Normal; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	page-break-after:avoid; 	mso-outline-level:1; 	font-size:11.0pt; 	mso-bidi-font-size:10.0pt; 	font-family:"Verdana","sans-serif"; 	mso-fareast-font-family:"Times New Roman"; 	mso-bidi-font-family:"Times New Roman"; 	mso-font-kerning:0pt; 	mso-fareast-language:EN-US; 	font-weight:normal;} h2 	{mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-link:"Heading 2 Char"; 	mso-style-next:Normal; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	page-break-after:avoid; 	mso-outline-level:2; 	font-size:11.0pt; 	mso-bidi-font-size:10.0pt; 	font-family:"Verdana","sans-serif"; 	mso-fareast-font-family:"Times New Roman"; 	mso-bidi-font-family:"Times New Roman"; 	mso-fareast-language:EN-US; 	font-weight:normal;} p.MsoTitle, li.MsoTitle, div.MsoTitle 	{mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-link:"Title Char"; 	margin:0in; 	margin-bottom:.0001pt; 	text-align:center; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Verdana","sans-serif"; 	mso-fareast-font-family:"Times New Roman"; 	mso-bidi-font-family:"Times New Roman"; 	color:#990000; 	mso-fareast-language:EN-US;} p.MsoBodyText, li.MsoBodyText, div.MsoBodyText 	{mso-style-noshow:yes; 	mso-style-unhide:no; 	mso-style-link:"Body Text Char"; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	mso-bidi-font-size:12.0pt; 	font-family:"Verdana","sans-serif"; 	mso-fareast-font-family:"Times New Roman"; 	mso-bidi-font-family:"Times New Roman"; 	mso-fareast-language:EN-US;} a:link, span.MsoHyperlink 	{mso-style-noshow:yes; 	mso-style-unhide:no; 	color:blue; 	mso-text-animation:none; 	text-decoration:none; 	text-underline:none; 	text-decoration:none; 	text-line-through:none;} a:visited, span.MsoHyperlinkFollowed 	{mso-style-noshow:yes; 	mso-style-unhide:no; 	color:purple; 	text-decoration:underline; 	text-underline:single;} p 	{mso-style-noshow:yes; 	mso-style-unhide:no; 	mso-margin-top-alt:auto; 	margin-right:0in; 	mso-margin-bottom-alt:auto; 	margin-left:0in; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Arial Unicode MS","sans-serif"; 	mso-fareast-language:EN-US;} span.Heading1Char 	{mso-style-name:"Heading 1 Char"; 	mso-style-unhide:no; 	mso-style-locked:yes; 	mso-style-link:"Heading 1"; 	mso-ansi-font-size:11.0pt; 	font-family:"Verdana","sans-serif"; 	mso-ascii-font-family:Verdana; 	mso-hansi-font-family:Verdana; 	mso-fareast-language:EN-US;} span.Heading2Char 	{mso-style-name:"Heading 2 Char"; 	mso-style-unhide:no; 	mso-style-locked:yes; 	mso-style-link:"Heading 2"; 	mso-ansi-font-size:11.0pt; 	font-family:"Verdana","sans-serif"; 	mso-ascii-font-family:Verdana; 	mso-hansi-font-family:Verdana; 	mso-fareast-language:EN-US;} span.TitleChar 	{mso-style-name:"Title Char"; 	mso-style-unhide:no; 	mso-style-locked:yes; 	mso-style-link:Title; 	mso-ansi-font-size:12.0pt; 	mso-bidi-font-size:12.0pt; 	font-family:"Verdana","sans-serif"; 	mso-ascii-font-family:Verdana; 	mso-hansi-font-family:Verdana; 	color:#990000; 	mso-fareast-language:EN-US;} span.BodyTextChar 	{mso-style-name:"Body Text Char"; 	mso-style-noshow:yes; 	mso-style-unhide:no; 	mso-style-locked:yes; 	mso-style-link:"Body Text"; 	mso-ansi-font-size:11.0pt; 	mso-bidi-font-size:12.0pt; 	font-family:"Verdana","sans-serif"; 	mso-ascii-font-family:Verdana; 	mso-hansi-font-family:Verdana; 	mso-fareast-language:EN-US;} .MsoChpDefault 	{mso-style-type:export-only; 	mso-default-props:yes; 	font-size:10.0pt; 	mso-ansi-font-size:10.0pt; 	mso-bidi-font-size:10.0pt;} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-priority:99; 	mso-style-qformat:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman","serif";} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p class="MsoTitle"&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;br /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: center;" align="center"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=""&gt;Abstract:&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; “Pattern” as the name suggests, means series of events occurring in a definite order. The patterns can be found in Java and J2ee technologies also. Many a times, we find that there is a particular way of tackling a problem. This way is easy and has been used many times successfully by a number of people earlier also. This method becomes a pattern.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Learning the design patterns is a multiple step process:&lt;br /&gt;1. Acceptance&lt;br /&gt;2. Recognition&lt;br /&gt;3. Internalization&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=""&gt;Patterns Defined:&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; The patterns can be defined in many ways. You can find the definitions of patterns in many good books.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;em&gt;&lt;b&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;“Design patterns are recurring solutions to design problems.”&lt;/span&gt;&lt;/b&gt;&lt;/em&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=""&gt;Patterns:&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; According to commonly known practices, there are 23 design patterns in Java. These patterns are grouped under three heads:&lt;br /&gt;1. Creational Patterns&lt;br /&gt;2. Structural Patterns&lt;br /&gt;3. Behavioral Patterns&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=""&gt;Creational Patterns&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;All the creational patterns define the best possible way in which an object can be instantiated. These describes the best way to CREATE object instances. Now everyone knows the object instance in Java can be created using a new operator.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style=""&gt;Book book = new Book (); &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;So, what’s the great stuff? Well, that’s true. The new Operator creates the instance of an object, but this is hard coding. As I have said earlier, creating good software is difficult and so, hard coding is the last thing one should do. Also, at times the very nature of the object, which is created, can change according to the nature of the program. In such scenarios, we can make use of patterns to give this a more general and flexible approach.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size: 11pt;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;There are five types of Creational Patterns.&lt;br /&gt;1. &lt;a href="http://www.allapplabs.com/java_design_patterns/factory_pattern.htm"&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; color: black;"&gt;Factory Pattern&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;2. &lt;a href="http://www.allapplabs.com/java_design_patterns/abstract_factory_pattern.htm"&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; color: black;"&gt;Abstract Factory Pattern&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;3. &lt;a href="http://www.allapplabs.com/java_design_patterns/builder_pattern.htm"&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; color: black;"&gt;Builder Pattern&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;4. &lt;a href="http://www.allapplabs.com/java_design_patterns/prototype_pattern.htm"&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; color: black;"&gt;Prototype Pattern&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;5. &lt;a href="http://www.allapplabs.com/java_design_patterns/singleton_pattern.htm"&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; color: black;"&gt;Singleton Pattern&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style=""&gt;Creational Patterns - Factory Pattern&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Factory of what? Of classes. In simple words, if we have a super class and n sub-classes, and based on data provided, we have to return the object of one of the sub-classes, we use a factory pattern.&lt;br /&gt;&lt;br /&gt;Let’s take an example to understand this pattern.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=""&gt;Example:&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; Let’s suppose an application asks for entering the name and sex of a person. If the sex is Male (M), it displays welcome message saying Hello Mr. &lt;name&gt; and if the sex is Female (F), it displays message saying Hello Ms &lt;name&gt;.&lt;br /&gt;&lt;br /&gt;The skeleton of the code can be given here.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public class Person {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;// name string&lt;br /&gt;  public String name;&lt;br /&gt;  // gender : M or F&lt;br /&gt;  private String gender; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public String getName() {&lt;br /&gt;  return name;&lt;br /&gt;  }&lt;br /&gt; &lt;br /&gt;  public String getGender() {&lt;br /&gt;  return gender;&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;This is a simple class Person having methods for name and gender. Now, we will have two sub-classes, Male and Female which will print the welcome message on the screen.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public class Male extends Person {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public Male(String fullName) {&lt;br /&gt;  System.out.println("Hello Mr. "+fullName);&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Also, the class Female&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public class Female extends Person {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public Female(String fullNname) {&lt;br /&gt;  System.out.println("Hello Ms. "+fullNname);&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Now, we have to create a client, or a SalutationFactory which will return the welcome message depending on the data provided. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public class SalutationFactory {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public static void main(String args[]) {&lt;br /&gt;  SalutationFactory factory = new SalutationFactory();&lt;br /&gt;  factory.getPerson(args[0], args[1]);&lt;br /&gt;  } &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public Person getPerson(String name,   String gender) {&lt;br /&gt;  if (gender.equals("M"))&lt;br /&gt;  return new Male(name);&lt;br /&gt;  else if(gender.equals("F"))&lt;br /&gt;  return new Female(name);&lt;br /&gt;  else&lt;br /&gt;  return null;&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;This class accepts two arguments from the system at runtime and prints the names. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Running the program:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoBodyText"&gt;After compiling and running the code on my computer with the arguments Prashant and M:&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;java Prashant M&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;The result returned is: “Hello Mr. Prashant”.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;When to use a Factory Pattern?&lt;br /&gt;The Factory patterns can be used in following cases:&lt;br /&gt;1. When a class does not know which class of objects it must create.&lt;br /&gt;2. A class specifies its sub-classes to specify which objects to create.&lt;br /&gt;3. In programmer’s language (very raw form), you can use factory pattern where you have to create an object of any one of sub-classes depending on the data provided.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=""&gt;Creational Patterns - Abstract Factory Pattern&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;This pattern is one level of abstraction higher than factory pattern. This means that the abstract factory returns the factory of classes. Like Factory pattern returned one of the several sub-classes, this returns such factory which later will return one of the sub-classes.&lt;br /&gt;&lt;br /&gt;Let’s understand this pattern with the help of an example.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Suppose we need to get the specification of various parts of a computer based on which work the computer will be used for.&lt;br /&gt;&lt;br /&gt;The different parts of computer are, say Monitor, RAM and Processor. The different types of computers are PC, Workstation and Server.&lt;br /&gt;&lt;br /&gt;So, here we have an abstract base class Computer.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package creational.abstractfactory; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public abstract class Computer {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * Abstract method, returns the Parts ideal for&lt;br /&gt;  * Server&lt;br /&gt;  * @return Parts&lt;br /&gt;  */&lt;br /&gt;  public abstract Parts getRAM(); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * Abstract method, returns the Parts ideal for&lt;br /&gt;  * Workstation&lt;br /&gt;  * @return Parts&lt;br /&gt;  */&lt;br /&gt;  public abstract Parts getProcessor();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * Abstract method, returns the Parts ideal for&lt;br /&gt;  * PC&lt;br /&gt;  * @return Parts&lt;br /&gt;  */&lt;br /&gt;  public abstract Parts getMonitor();&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;This class, as you can see, has three methods all returning different parts of computer. They all return a method called Parts. The specification of Parts will be different for different types of computers. Let’s have a look at the class Parts.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package creational.abstractfactory; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public class Parts {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * specification of Part of Computer, String&lt;br /&gt;  */&lt;br /&gt;  public String specification; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * Constructor sets the name of OS&lt;br /&gt;  * @param specification of Part of Computer&lt;br /&gt;  */&lt;br /&gt;  public Parts(String specification) {&lt;br /&gt;  this.specification = specification;&lt;br /&gt;  }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * Returns the name of the part of Computer&lt;br /&gt;  *&lt;br /&gt;  * @return specification of Part of Computer, String&lt;br /&gt;  */&lt;br /&gt;  public String getSpecification() {&lt;br /&gt;  return specification;&lt;br /&gt;  }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;And now lets go to the sub-classes of Computer. They are PC, Workstation and Server.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package creational.abstractfactory; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public class PC extends Computer {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * Method over-ridden from Computer, returns the Parts ideal for&lt;br /&gt;  * Server&lt;br /&gt;  * @return Parts&lt;br /&gt;  */&lt;br /&gt;  public Parts getRAM() {&lt;br /&gt;  return new Parts("512 MB");&lt;br /&gt;  } &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * Method over-ridden from Computer, returns the Parts ideal for&lt;br /&gt;  * Workstation&lt;br /&gt;  * @return Parts&lt;br /&gt;  */&lt;br /&gt;  public Parts getProcessor() {&lt;br /&gt;  return new Parts("Celeron");&lt;br /&gt;  }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * Method over-ridden from Computer, returns the Parts ideal for&lt;br /&gt;  * PC&lt;br /&gt;  * @return Parts&lt;br /&gt;  */&lt;br /&gt;  public Parts getMonitor() {&lt;br /&gt;  return new Parts("15 inches");&lt;br /&gt;  }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package creational.abstractfactory;&lt;br /&gt; &lt;br /&gt;  public class Workstation extends Computer { &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * Method over-ridden from Computer, returns the Parts ideal for&lt;br /&gt;  * Server&lt;br /&gt;  * @return Parts&lt;br /&gt;  */&lt;br /&gt;  public Parts getRAM() {&lt;br /&gt;  return new Parts("1 GB");&lt;br /&gt;  } &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * Method over-ridden from Computer, returns the Parts ideal for&lt;br /&gt;  * Workstation&lt;br /&gt;  * @return Parts&lt;br /&gt;  */&lt;br /&gt;  public Parts getProcessor() {&lt;br /&gt;  return new Parts("Intel P 3");&lt;br /&gt;  }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * Method over-ridden from Computer, returns the Parts ideal for&lt;br /&gt;  * PC&lt;br /&gt;  * @return Parts&lt;br /&gt;  */&lt;br /&gt;  public Parts getMonitor() {&lt;br /&gt;  return new Parts("19 inches");&lt;br /&gt;  }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package creational.abstractfactory; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public class Server extends Computer{ &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * Method over-ridden from Computer, returns the Parts ideal for&lt;br /&gt;  * Server&lt;br /&gt;  * @return Parts&lt;br /&gt;  */&lt;br /&gt;  public Parts getRAM() {&lt;br /&gt;  return new Parts("4 GB");&lt;br /&gt;  } &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * Method over-ridden from Computer, returns the Parts ideal for&lt;br /&gt;  * Workstation&lt;br /&gt;  * @return Parts&lt;br /&gt;  */&lt;br /&gt;  public Parts getProcessor() {&lt;br /&gt;  return new Parts("Intel P 4");&lt;br /&gt;  }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * Method over-ridden from Computer, returns the Parts ideal for&lt;br /&gt;  * PC&lt;br /&gt;  * @return Parts&lt;br /&gt;  */&lt;br /&gt;  public Parts getMonitor() {&lt;br /&gt;  return new Parts("17 inches");&lt;br /&gt;  }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Now let’s have a look at the Abstract factory which returns a factory “Computer”. We call the class ComputerType.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="3" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package creational.abstractfactory;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * This is the computer abstract factory which returns one&lt;br /&gt;  * of the three types of computers.&lt;br /&gt;  *&lt;br /&gt;  */&lt;br /&gt;  public class ComputerType {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;private Computer comp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public static void main(String[] args) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;ComputerType type = new ComputerType(); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Computer computer =   type.getComputer("Server");&lt;br /&gt;  System.out.println("Monitor: "+computer.getMonitor().getSpecification());&lt;br /&gt;  System.out.println("RAM: "+computer.getRAM().getSpecification());&lt;br /&gt;  System.out.println("Processor:   "+computer.getProcessor().getSpecification());&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;} &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 9%;" valign="top" width="9%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 81%;" width="81%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * Returns a computer for a type&lt;br /&gt;  *&lt;br /&gt;  * @param computerType String, PC / Workstation / Server&lt;br /&gt;  * @return Computer&lt;br /&gt;  */&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public Computer getComputer(String   computerType) {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;if (computerType.equals("PC"))&lt;br /&gt;  comp = new PC();&lt;br /&gt;  else if(computerType.equals("Workstation"))&lt;br /&gt;  comp = new Workstation();&lt;br /&gt;  else if(computerType.equals("Server"))&lt;br /&gt;  comp = new Server(); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;return comp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td colspan="3" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Running this class gives the output as this:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Monitor: 17 inches&lt;br /&gt;RAM: 4 GB&lt;br /&gt;Processor: Intel P 4.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;When to use Abstract Factory Pattern?&lt;br /&gt;One of the main advantages of Abstract Factory Pattern is that it isolates the concrete classes that are generated. The names of actual implementing classes are not needed to be known at the client side. Because of the isolation, you can change the implementation from one factory to another.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=""&gt;Creational Patterns - Singleton Pattern&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoBodyText"&gt;&lt;span style=""&gt;This is one of the most commonly used patterns. There are some instances in the application where we have to use just one instance of a particular class. Let’s take up an example to understand this.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;A very simple example is say Logger, suppose we need to implement the logger and log it to some file according to date time. In this case, we cannot have more than one instances of Logger in the application otherwise the file in which we need to log will be created with every instance.&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;We use Singleton pattern for this and instantiate the logger when the first request hits or when the server is started.&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package creational.singleton; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;import org.apache.log4j.Priority;&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;import java.text.SimpleDateFormat;&lt;br /&gt;  import java.util.GregorianCalendar;&lt;br /&gt;  import java.util.Properties;&lt;br /&gt;  import java.io.InputStream;&lt;br /&gt;  import java.io.FileOutputStream;&lt;br /&gt;  import java.io.PrintStream;&lt;br /&gt;  import java.io.IOException;&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public class Logger {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" valign="top" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;private String fileName;&lt;br /&gt;  private Properties properties;&lt;br /&gt;  private Priority priority;&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * Private constructor&lt;br /&gt;  */&lt;br /&gt;  private Logger() {&lt;br /&gt;  logger = this;&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * Level of logging, error or information etc&lt;br /&gt;  *&lt;br /&gt;  * @return level, int&lt;br /&gt;  */&lt;br /&gt;  public int getRegisteredLevel() {&lt;br /&gt;  int i = 0;&lt;br /&gt;  try {&lt;br /&gt;  InputStream inputstream = getClass().getResourceAsStream("Logger.properties");&lt;br /&gt;  properties.load(inputstream);&lt;br /&gt;  inputstream.close();&lt;br /&gt;  i =   Integer.parseInt(properties.getProperty("**logger.registeredlevel**"));&lt;br /&gt;  if(i &lt;&gt; 3)&lt;br /&gt;  i = 0;&lt;br /&gt;  }&lt;br /&gt;  catch(Exception exception) {&lt;br /&gt;  System.out.println("Logger: Failed in the getRegisteredLevel   method");&lt;br /&gt;  exception.printStackTrace();&lt;br /&gt;  }&lt;br /&gt;  return i;&lt;br /&gt;  }&lt;br /&gt;  /**&lt;br /&gt;  * One file will be made daily. So, putting date time in file&lt;br /&gt;  * name.&lt;br /&gt;  *&lt;br /&gt;  * @param gc GregorianCalendar&lt;br /&gt;  * @return String, name of file&lt;br /&gt;  */&lt;br /&gt;  private String getFileName(GregorianCalendar gc) {&lt;br /&gt;  SimpleDateFormat dateFormat1 = new SimpleDateFormat("dd-MMM-yyyy");&lt;br /&gt;  String dateString = dateFormat1.format(gc.getTime());&lt;br /&gt;  String fileName =   "C:\\prashant\\patterns\\log\\PatternsExceptionLog-" + dateString +   ".txt";&lt;br /&gt;  return fileName;&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * A mechanism to log message to the file.&lt;br /&gt;  *&lt;br /&gt;  * @param p Priority&lt;br /&gt;  * @param message String&lt;br /&gt;  */&lt;br /&gt;  public void logMsg(Priority p, String message) {&lt;br /&gt;  try {&lt;br /&gt;  GregorianCalendar gc = new GregorianCalendar();&lt;br /&gt;  String fileName = getFileName(gc);&lt;br /&gt;  FileOutputStream fos = new FileOutputStream(fileName, true);&lt;br /&gt;  PrintStream ps = new PrintStream(fos);&lt;br /&gt;  SimpleDateFormat dateFormat2 = new SimpleDateFormat("EEE, MMM d, yyyy   'at' hh:mm:ss a");&lt;br /&gt;  ps.println("&lt;"+dateFormat2.format(gc.getTime())+"&gt;["+message+"]");&lt;br /&gt;  ps.close();&lt;br /&gt;  }&lt;br /&gt;  catch (IOException ie) {&lt;br /&gt;  ie.printStackTrace();&lt;br /&gt;  }&lt;br /&gt;  }&lt;br /&gt;  /**&lt;br /&gt;  * this method initialises the logger, creates an object&lt;br /&gt;  */&lt;br /&gt;  public static void initialize() {&lt;br /&gt;  logger = new Logger();&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;// singleton - pattern&lt;br /&gt;  private static Logger logger;&lt;br /&gt;  public static Logger getLogger() {&lt;br /&gt;  return logger;&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=""&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=""&gt;Difference between static class and static method approaches:&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;br /&gt;One question which a lot of people have been asking me. What’s the difference between a singleton class and a static class? The answer is static class is one approach to make a class “Singleton”.&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;We can create a class and declare it as “final” with all the methods “static”. In this case, you can’t create any instance of class and can call the static methods directly.&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Example:&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;final class Logger {&lt;br /&gt;//a static class implementation of Singleton pattern&lt;br /&gt;static public void logMessage(String s) {&lt;br /&gt;System.out.println(s);&lt;br /&gt;}&lt;br /&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;//==============================&lt;br /&gt;public class StaticLogger {&lt;br /&gt;public static void main(String args[]) {&lt;br /&gt;Logger.logMessage("This is SINGLETON");&lt;br /&gt;}&lt;br /&gt;}// End of class&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;The advantage of this static approach is that it’s easier to use. The disadvantage of course is that if in future you do not want the class to be static anymore, you will have to do a lot of recoding.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=""&gt;Creational Patterns - Builder Pattern&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Builder, as the name suggests builds complex objects from simple ones step-by-step. It separates the construction of complex objects from their representation. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoBodyText"&gt;Let’s take a non-software example for this. Say, we have to plan for a children meal at a fast food restaurant. What is it comprised of? Well, a burger, a cold drink, a medium fries and a toy.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;This is common to all the fast food restaurants and all the children meals. Here, what is important? Every time a children’s meal is ordered, the service boy will take a burger, a fries, a cold drink and a toy. Now suppose, there are 3 types of burgers available. Vegetable, Fish and Chicken, 2 types of cold drinks available. Cola and Orange and 2 types of toys available, a car and a doll.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;So, the order might be a combination of one of these, but the process will be the same. One burger, one cold drink, one fries and one toy. All these items are placed in a paper bag and is given to the customer.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Now let’s see how we can apply software to this above-mentioned example.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;The whole thing is called a children meal. Each of the four burger, cold drink, fries and toy are items in the meal. So, we can say, there is an interface Item having two methods, pack() and price().&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Let’s take a closer look at the interface Item:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style=""&gt;Item.java&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package creational.builder;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public interface Item {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * pack is the method, as every item will be packed&lt;br /&gt;  * in a different way.&lt;br /&gt;  * E.g.:- The burger will be packed as wrapped in a paper&lt;br /&gt;  * The cold drink will be given in a glass&lt;br /&gt;  * The medium fries will be packed in a card box and&lt;br /&gt;  * The toy will be put in the bag straight.&lt;br /&gt;  * The class Packing is an interface for different types of&lt;br /&gt;  * for different Items.&lt;br /&gt;  */&lt;br /&gt; &lt;br /&gt;  public Packing pack(); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * price is the method as all the items&lt;br /&gt;  * burger, cold drink, fries will have a price.&lt;br /&gt;  * The toy will not have any direct price, it will&lt;br /&gt;  * be given free with the meal.&lt;br /&gt;  *&lt;br /&gt;  * The total price of the meal will be the combined&lt;br /&gt;  * price of the three items.&lt;br /&gt;  *&lt;br /&gt;  * @return price, int in rupees.&lt;br /&gt;  */&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public int price();&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;So, we must now have a class defined for each of the items, as burger, toy, cold drink and fries. All these will implement the Item interface.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Lets start with Burger:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style=""&gt;Burger.java&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package creational.builder;&lt;br /&gt;  /**&lt;br /&gt;  * The class remains abstract as price method will be implemented&lt;br /&gt;  * according to type of burger.&lt;br /&gt;  * @see price()&lt;br /&gt;  *&lt;br /&gt;  */&lt;br /&gt;  public abstract class Burger implements Item {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * A burger is packed in a wrapper. Its wrapped&lt;br /&gt;  * in the paper and is served. The class Wrapper is&lt;br /&gt;  * sub-class of Packing interface.&lt;br /&gt;  * @return new Wrapper for every burger served.&lt;br /&gt;  */&lt;br /&gt;  public Packing pack() {&lt;br /&gt;  return new Wrapper();&lt;br /&gt;  } &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * This method remains abstract and cannot be&lt;br /&gt;  * given an implementation as the real implementation&lt;br /&gt;  * will lie with the type of burger.&lt;br /&gt;  *&lt;br /&gt;  * E.g.:- Veg Burger will have a different price from&lt;br /&gt;  * a fish burger.&lt;br /&gt;  *&lt;br /&gt;  * @return price, int.&lt;br /&gt;  */&lt;br /&gt;  public abstract int price();&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;br /&gt;The class Burger can be further extended to VegBurger, FishBurger, ChickenBurger etc. These classes will each implement the price() method and return a price for each type of burger. I, in this example have given the implementation for VegBurger class.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style=""&gt;VegBurger.java&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package creational.builder;&lt;br /&gt; &lt;br /&gt;  /**&lt;br /&gt;  * The implementation of price method.&lt;br /&gt;  */&lt;br /&gt;  public class VegBurger extends Burger {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * This is the method implementation from&lt;br /&gt;  * the super class Burger.&lt;br /&gt;  *&lt;br /&gt;  * @return price of a veg burger in rupees.&lt;br /&gt;  */&lt;br /&gt;  public int price() {&lt;br /&gt;  return 39;&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;br /&gt;Let’s concentrate on other items now. I, here for explanation purpose will give another item Fries.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style=""&gt;Fries.java &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package creational.builder; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * Implements the Item interface.&lt;br /&gt;  */&lt;br /&gt;  public class Fries implements Item {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * Packing in which fries are served.&lt;br /&gt;  *&lt;br /&gt;  * @return new Packing for every fries.&lt;br /&gt;  * Envelop is a packing in which fries are given&lt;br /&gt;  */&lt;br /&gt;  public Packing pack() {&lt;br /&gt;  return new Envelop();&lt;br /&gt;  } &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * Price of the medium fries.&lt;br /&gt;  *&lt;br /&gt;  * @return int , price of medium fries in rupees&lt;br /&gt;  */&lt;br /&gt;  public int price() {&lt;br /&gt;  return 25;&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Now, let’s see the Builder class, MealBuilder. This class is the one which serves the Children’s meal.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style=""&gt;MealBuilder.java &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package creational.builder;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * Main builder class which builds the entire meal&lt;br /&gt;  * for the customers&lt;br /&gt;  */&lt;br /&gt;  public class MealBuilder {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public Packing additems() {&lt;br /&gt;  Item[] items = {new VegBurger(), new Fries(), new Cola(), new Doll()} &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;return new MealBox().addItems(items);&lt;br /&gt;  }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public int calculatePrice() {&lt;br /&gt;  int totalPrice = new VegBurger().price() + new Cola().price() + new   Fries().price() + new Doll().price();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;return totalPrice;&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;This class gives the total meal and also presents the total price. Here, we have abstracted the price calculation and meal package building activity from the presentation, which is a meal box. The Builder pattern hides the internal details of how the product is built.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Each builder is independent of others. This improves modularity and makes the building of other builders easy.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Because, each builder builds the final product step by step, we have more control on the final product. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=""&gt;Creational Patterns - Prototype Pattern&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;The prototype means making a clone. This implies cloning of an object to avoid creation. If the cost of creating a new object is large and creation is resource intensive, we clone the object. We use the interface Cloneable and call its method clone() to clone the object.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Again let’s try and understand this with the help of a non-software example. I am stressing on general examples throughout this write-up because I find them easy to understand and easy to accept as we all read and see them in day-to-day activity. The example here we will take will be of a plant cell. This example is a bit different from the actual cloning in a way that cloning involves making a copy of the original one. Here, we break the cell in two and make two copies and the original one does not exist. But, this example will serve the purpose. Let’s say the Mitotic Cell Division in plant cells.&lt;br /&gt;Let’s take a class PlantCell having a method split(). The plant cell will implement the interface Cloneable. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Following is the sample code for class PlantCell.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=""&gt;PlantCell.java&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="4" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package creational.builder;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * Shows the Mitotic cell division in the plant cell.&lt;br /&gt;  */&lt;br /&gt;  public class PlantCell implements Cloneable {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="3" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public Object split() {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;try {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 6%;" width="6%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 77%;" width="77%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;return super.clone();&lt;br /&gt;  }catch(Exception e) {&lt;br /&gt;  System.out.println("Exception occured: "+e.getMessage());&lt;br /&gt;  return null;&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 7%;" width="7%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td colspan="4" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;br /&gt;Now let’s see, how this split method works for PlantCell class. We will make another class CellDivision and access this method. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=""&gt;CellDivision.java&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package creational.prototype;&lt;br /&gt;  /**&lt;br /&gt;  * Shows how to use the clone.&lt;br /&gt;  */&lt;br /&gt;  public class CellDivision {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" width="90%"&gt;   &lt;p class="MsoBodyText"&gt;public static void main(String[] args) {&lt;br /&gt;  PlantCell cell = new PlantCell(); &lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;// create a clone&lt;br /&gt;  PlantCell newPlantCell = (PlantCell)cell.split();&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;br /&gt;One thing is you cannot use the clone as it is. You need to instantiate the clone before using it. This can be a performance drawback. This also gives sufficient access to the data and methods of the class. This means the data access methods have to be added to the prototype once it has been cloned.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=""&gt;Structural Patterns&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoBodyText"&gt;Structural Patterns describe how objects and classes can be combined to form larger structures. The difference between class patterns and object patterns is that class patterns describe abstraction with the help of inheritance and how it can be used to provide more useful program interface. Object patterns, on other hand, describe how objects can be associated and composed to form larger, more complex structures.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;There are seven structural patterns described. They are as follows:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Patterns.&lt;br /&gt;1. &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Adapter Pattern&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;br /&gt;2. &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Bridge Pattern&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;br /&gt;3. &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Composite Pattern&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;br /&gt;4. &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Decorator Pattern&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;br /&gt;5. &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Facade Pattern&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;br /&gt;6. &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Flyweight Pattern&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;br /&gt;7. &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Proxy Pattern&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=""&gt;Structural Patterns - Adapter Pattern&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;The Adapter pattern is used so that two unrelated interfaces can work together. The joining between them is called an Adapter. This is something like we convert interface of one class into interface expected by the client. We do that using an Adapter.&lt;br /&gt;&lt;br /&gt;Let’s try and understand this with the help of an example. Again, I will like to take a general example. We all have electric sockets in our houses of different sizes and shapes. I will take an example of a socket of 15 Ampere. This is a bigger socket and the other one, which is smaller, is of 5 Ampere. A 15 Amp plug cannot fit into a 5 Amp socket. Here, we will use an Adapter. The adapter can be called a connector here. The connector connects both of these and gives output to the client plug, which is of 5 Amp.&lt;br /&gt;&lt;br /&gt;The Adapter is something like this. It will be having the plug of suitable for 15 Amp and a socket suitable for a 5 Amp plug. So, that the 5 Amp plug which here is the client can fit in and also the server which here is the 15 Amp socket can give the output.&lt;br /&gt;&lt;br /&gt;Let’s try and convert the same example into a software program. How do we do this? Let’s try and understand the problem once more. We have a 5 Amp plug and want a 5 Amp socket so that it can work. We DO NOT have a 5 Amp socket, what we have is a 15 Amp socket in which the 5 Amp plug cannot fit. The problem is how to cater to the client without changing the plug or socket.&lt;br /&gt;&lt;br /&gt;The Adapter Pattern can be implemented in two ways, by Inheritance and by Composition.&lt;br /&gt;&lt;br /&gt;Here is the example of Adapter by Inheritance:&lt;br /&gt;&lt;br /&gt;Let’s say there is a socket interface.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style=""&gt;Socket.java&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package structural.adapter.inheritance;&lt;br /&gt;  /**&lt;br /&gt;  * The socket class has a specs for 15 AMP.&lt;br /&gt;  */&lt;br /&gt;  public interface Socket { &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" valign="top" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * This method is used to match the input to be&lt;br /&gt;  * given to the Plug&lt;br /&gt;  *&lt;br /&gt;  * @return Output of the Plug (Client)&lt;br /&gt;  */&lt;br /&gt;  public String getOutput();&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of interface&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;And there is a class Plug which wants the input of 5 AMP. This is the client.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style=""&gt;Plug.java&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package structural.adapter.inheritance;&lt;br /&gt;  /**&lt;br /&gt;  * The input for the plug is 5 AMP. which is a&lt;br /&gt;  * mismatch for a 15 AMP socket.&lt;br /&gt;  *&lt;br /&gt;  * The Plug is the client. We need to cater to&lt;br /&gt;  * the requirements of the Plug.&lt;br /&gt;  */&lt;br /&gt;  public class Plug {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" valign="top" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;private String specification = "5   AMP"; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public String getInput() {&lt;br /&gt;  return specification;&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 14.25pt;"&gt;   &lt;td colspan="2" style="padding: 0.75pt; height: 14.25pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;br /&gt;Finally, there will be an adapter class. This will inherit the socket and give output for Plug.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style=""&gt;ConnectorAdapter.java &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package structural.adapter.inheritance;&lt;br /&gt;  /**&lt;br /&gt;  * ConnectorAdapter has is the connector between&lt;br /&gt;  * the socket and plug so as to make the interface&lt;br /&gt;  * of one system to suit the client.&lt;br /&gt;  */&lt;br /&gt;  public class ConnectorAdapter implements Socket {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" valign="top" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * Method coming from the interface&lt;br /&gt;  * Socket which we have to make to&lt;br /&gt;  * fit the client plug&lt;br /&gt;  *&lt;br /&gt;  * @return Desired output of 5 AMP&lt;br /&gt;  */&lt;br /&gt;  public String getOutput() {&lt;br /&gt;  Plug plug = new Plug();&lt;br /&gt;  String output = plug.getInput();&lt;br /&gt;  return output;&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 14.25pt;"&gt;   &lt;td colspan="2" style="padding: 0.75pt; height: 14.25pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;br /&gt;This class implements the getOutput() method of Socket and sets it to fit the client output.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Similarly, let’s consider the Association and Composition of objects by which Adapter can be implemented.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;The class Socket gives the 15 AMP output.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=""&gt;Socket.java&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package structural.adapter.composition;&lt;br /&gt;  /**&lt;br /&gt;  * Class socket giving the 15 AMP output.&lt;br /&gt;  */&lt;br /&gt;  public class Socket {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" valign="top" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * Output of 15AMP returned.&lt;br /&gt;  *&lt;br /&gt;  * @return Value of output from socket&lt;br /&gt;  */&lt;br /&gt;  public String getOutput() {&lt;br /&gt;  return "15 AMP";&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 14.25pt;"&gt;   &lt;td colspan="2" style="padding: 0.75pt; height: 14.25pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;There is an interface Plug.java which has a method getInput(). This is the client and we need to adapt the output for this input which is 5 AMP.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=""&gt;Plug.java&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package structural.adapter.composition;&lt;br /&gt;  /**&lt;br /&gt;  * The input for the plug is 5 AMP. which is a&lt;br /&gt;  * mismatch for a 15 AMP socket.&lt;br /&gt;  *&lt;br /&gt;  * The Plug is the client. We need to cater to&lt;br /&gt;  * the requirements of the Plug.&lt;br /&gt;  */&lt;br /&gt;  public interface Plug {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" valign="top" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public String getInput(); &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 14.25pt;"&gt;   &lt;td colspan="2" style="padding: 0.75pt; height: 14.25pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Plug5AMP is the implementation of Plug which requires 5 AMP of input.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=""&gt;Plug5AMP.java&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package structural.adapter.composition;&lt;br /&gt; &lt;br /&gt;  public class Plug5AMP implements Plug { &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" valign="top" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * Get the input of client i.e. Plug&lt;br /&gt;  *&lt;br /&gt;  * @return 5 AMP&lt;br /&gt;  */&lt;br /&gt;  public String getInput() {&lt;br /&gt;  return "5 AMP";&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 14.25pt;"&gt;   &lt;td colspan="2" style="padding: 0.75pt; height: 14.25pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;The Adapter here takes output from the Socket. If the output is what is needed, it gives it to the Plug else, it overrides the value and returns the adapter output.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style=""&gt;ConnectorAdapter.java&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package structural.adapter.composition;&lt;br /&gt;  /**&lt;br /&gt;  * Using composition&lt;br /&gt;  */&lt;br /&gt;  public class ConnectorAdapter { &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" valign="top" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Plug5AMP plug5; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public ConnectorAdapter(Plug5AMP plug) {&lt;br /&gt;  this.plug5 = plug;&lt;br /&gt;  }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public static void main(String[] args) {&lt;br /&gt;  // Taking output from the Socket&lt;br /&gt;  Socket socket = new Socket();&lt;br /&gt;  String outputFromSocket = socket.getOutput();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;// Giving away input to the Plug&lt;br /&gt;  ConnectorAdapter adapter = new ConnectorAdapter(new Plug5AMP());&lt;br /&gt;  String inputToPlug = adapter.getAdapterOutput(outputFromSocket);&lt;br /&gt;  System.out.println("New output by adapter is: "+inputToPlug);&lt;br /&gt;  }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public String getAdapterOutput(String   outputFromScoket) {&lt;br /&gt;  /*&lt;br /&gt;  * if output is same, return&lt;br /&gt;  */&lt;br /&gt;  if (outputFromScoket.equals(plug5.getInput())) {&lt;br /&gt;  return outputFromScoket;&lt;br /&gt;  }&lt;br /&gt;  /*&lt;br /&gt;  * Else, override the value by adapterOutput&lt;br /&gt;  */&lt;br /&gt;  else {&lt;br /&gt;  String adapterOutput = plug5.getInput();&lt;br /&gt;  return adapterOutput;&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 14.25pt;"&gt;   &lt;td colspan="2" style="padding: 0.75pt; height: 14.25pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;This is how the Adapter pattern works. When one interface cannot be changed and has to be suited to the again cannot-be-changed client, an adapter is used so that both the interfaces can work together. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=""&gt;Structural Patterns - Bridge Pattern&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;The Bridge Pattern is used to separate out the interface from its implementation. Doing this gives the flexibility so that both can vary independently.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;The best example for this is like the electric equipments you have at home and their switches. For e.g., the switch of the fan. The switch is the interface and the actual implementation is the Running of the fan once its switched-on. Still, both the switch and the fan are independent of each other. Another switch can be plugged in for the fan and this switch can be connected to light bulb.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Let’s see how we can convert this into a software program. Switch is the interface having two functions, switchOn() and switchOff().&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Here is the sample code for Switch.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style=""&gt;Switch.java&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package structural.bridge;&lt;br /&gt;  /**&lt;br /&gt;  * Just two methods. on and off.&lt;br /&gt;  */&lt;br /&gt;  public interface Switch {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" valign="top" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;// Two positions of switch.&lt;br /&gt;  public void switchOn();&lt;br /&gt;  public void switchOff();&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of interface&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;This switch can be implemented by various devices in house, as Fan, Light Bulb etc. Here is the sample code for that.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style=""&gt;Fan.java&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package structural.bridge;&lt;br /&gt;  /**&lt;br /&gt;  * Implement the switch for Fan&lt;br /&gt;  */&lt;br /&gt;  public class Fan implements Switch {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" valign="top" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;// Two positions of switch.&lt;br /&gt;  public void switchOn() {&lt;br /&gt;  System.out.println("FAN Switched ON");&lt;br /&gt;  } &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public void switchOff() {&lt;br /&gt;  System.out.println("FAN Switched OFF");&lt;br /&gt;  }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 14.25pt;"&gt;   &lt;td colspan="2" style="padding: 0.75pt; height: 14.25pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;br /&gt;And implementation as Bulb.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style=""&gt;Bulb.java &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package structural.bridge;&lt;br /&gt;  /**&lt;br /&gt;  * Implement the switch for Fan&lt;br /&gt;  */&lt;br /&gt;  public class Bulb implements Switch {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" valign="top" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;// Two positions of switch.&lt;br /&gt;  public void switchOn() {&lt;br /&gt;  System.out.println("BULB Switched ON");&lt;br /&gt;  } &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public void switchOff() {&lt;br /&gt;  System.out.println("BULB Switched OFF");&lt;br /&gt;  }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 14.25pt;"&gt;   &lt;td colspan="2" style="padding: 0.75pt; height: 14.25pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoBodyText"&gt;&lt;br /&gt;Here, we can see, that the interface Switch can be implemented in different ways. Here, we can easily use Switch as an interface as it has only two functions, on and off. But, there may arise a case where some other function be added to it, like change() (change the switch). In this case, the interface will change and so, the implementations will also changed, for such cases, you should use the Switch as abstract class. This decision should be made earlier to implementation whether the interface should be interface or abstract class. &lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=""&gt;Structural Patterns - Composite Pattern&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoBodyText"&gt;&lt;span style=""&gt;In developing applications, we come across components, which are individual objects and also can be collection of objects. Composite pattern can represent both the conditions. In this pattern, you can develop tree structures for representing part-whole hierarchies.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;The most common example in this pattern is of a company’s employee hierarchy. We here will also take the same example.&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;The employees of a company are at various positions. Now, say in a hierarchy, the manager has subordinates; also the Project Leader has subordinates, i.e. employees reporting to him/her. The developer has no subordinates.&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;So, let’s have a look at the class Employee: This is a simple class with getters and setters for attributes as name, salary and subordinates.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style=""&gt;Employee.java&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package structural.composite;&lt;br /&gt; &lt;br /&gt;  import java.util.Vector;&lt;br /&gt; &lt;br /&gt;  public class Employee {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" valign="top" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;private String name;&lt;br /&gt;  private double salary;&lt;br /&gt;  private Vector subordinates;&lt;br /&gt; &lt;br /&gt;  public Vector getSubordinates() {&lt;br /&gt;  return subordinates;&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public void setSubordinates(Vector   subordinates) {&lt;br /&gt;  this.subordinates = subordinates;&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;br /&gt;  // constructor&lt;br /&gt;  public Employee(String name, double sal) {&lt;br /&gt;  setName(name);&lt;br /&gt;  setSalary(sal);&lt;br /&gt;  subordinates = new Vector();&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public String getName() {&lt;br /&gt;  return name;&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public void setName(String name) {&lt;br /&gt;  this.name = name;&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public double getSalary() {&lt;br /&gt;  return salary;&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public void setSalary(double salary) {&lt;br /&gt;  this.salary = salary;&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public void add(Employee e) {&lt;br /&gt;  subordinates.addElement(e);&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public void remove(Employee e) {&lt;br /&gt;  subordinates.remove(e);&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of interface&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Next we, fill up the tree. You can make a class to access the class Employee and try filling up the tree like this:&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;br /&gt; &lt;br /&gt;  /**&lt;br /&gt;  * This will add employess to the tree. The boss, is PM&lt;br /&gt;  * and has subordinates.&lt;br /&gt;  */&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" valign="top" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;private void addEmployeesToTree() {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;   &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;CFO = new Employee("CFO",   30000);&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Employee headFinance1 = new   Employee("Head Finance. North Zone", 20000);&lt;br /&gt;  Employee headFinance2 = new Employee("Head Finance. West Zone",   22000);&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Employee accountant1 = new   Employee("Accountant1", 10000);&lt;br /&gt;  Employee accountant2 = new Employee("Accountant2", 9000);&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Employee accountant3 = new   Employee("Accountant3", 11000);&lt;br /&gt;  Employee accountant4 = new Employee("Accountant4", 12000);&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;CFO.add(headFinance1);&lt;br /&gt;  CFO.add(headFinance2);&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;headFinance1.add(accountant1);&lt;br /&gt;  headFinance1.add(accountant4);&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;headFinance2.add(accountant2);&lt;br /&gt;  headFinance2.add(accountant3);&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 14.25pt;"&gt;   &lt;td colspan="2" style="padding: 0.75pt; height: 14.25pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;br /&gt;Once we have filled the tree up, now we can get the tree for any employee and find out whether that employee has subordinates with the following condition.&lt;br /&gt;&lt;br /&gt;Vector subOrdinates = emp.getSubordinates();&lt;br /&gt;if (subOrdinates.size() != 0)&lt;br /&gt;getTree(subOrdinates);&lt;br /&gt;else&lt;br /&gt;System.out.println("No Subordinates for the Employee: "+emp.getName());&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Thus the Composite pattern allows you to create a tree like structure for simple and complex objects so they appear the same to the client. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=""&gt;Structural Patterns - Decorator Pattern&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;The decorator pattern helps to add behavior or responsibilities to an object. This is also called “Wrapper”. Suppose we have some 6 objects and 2 of them need a special behavior, we can do this with the help of a decorator.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Java Design Patterns suggest that Decorators should be abstract classes and the concrete implementation should be derived from them.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoBodyText"&gt;The decorator pattern can be use wherever there is a need to add some functionality to the object or group of objects. Let’s take an example of a Christmas tree. There is a need to decorate a Christmas tree. Now we have many branches which need to be decorated in different ways.&lt;br /&gt;&lt;br /&gt;Let’s have a look at the basic Decorator class. &lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=""&gt;Decorator.java&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package structural.decorator; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public abstract class Decorator {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" valign="top" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/*&lt;br /&gt;  * The method places each decorative item&lt;br /&gt;  * on the tree.&lt;br /&gt;  */&lt;br /&gt;  public abstract void place(Branch branch);&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;This class has just one method place(). This method places different types of items on the branches of the tree.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;The class ChristmasTree is very simple and has just one method which returns a branch.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style=""&gt;ChristmasTree.java&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package structural.decorator; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public class ChristmasTree {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" valign="top" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;private Branch branch; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public Branch getBranch() {&lt;br /&gt;  return branch;&lt;br /&gt;  } &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 14.25pt;"&gt;   &lt;td colspan="2" style="padding: 0.75pt; height: 14.25pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Now we can decorate the branches in three different ways, one is by putting colored balls on them, by putting colored ruffles on them and also by putting stars on them.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Let’s have a look at the implementation of these three different types of decorators.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style=""&gt;BallDecorator.java &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package structural.decorator; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * Decorates the branch of the tree with&lt;br /&gt;  * coloured balls.&lt;br /&gt;  */&lt;br /&gt;  public class BallDecorator extends Decorator {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" valign="top" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;// Default Constructor&lt;br /&gt;  public BallDecorator(ChristmasTree tree) {&lt;br /&gt;  Branch branch = tree.getBranch();&lt;br /&gt;  place(branch);&lt;br /&gt;  } &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/*&lt;br /&gt;  * The method places each decorative item&lt;br /&gt;  * on the tree.&lt;br /&gt;  */&lt;br /&gt;  public void place(Branch branch) {&lt;br /&gt;  branch.put("ball");&lt;br /&gt;  } &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 14.25pt;"&gt;   &lt;td colspan="2" style="padding: 0.75pt; height: 14.25pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Similarly, we can make StarDecorator and RufflesDecorator. Now, we will see how to use the decorator. Its simple, we just are needed to pass the instance of ChristmasTree class to a decorator.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;StarDecorator decorator = new StarDecorator(new ChristmasTree());&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;This way the decorator will be instantiated and a branch of the Christmas tree will be decorated. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;This is a very abstract example and could not be implemented in terms of code fully. But, then, as I have said, I want you to understand the patterns rather than giving you concrete examples. Once the pattern is internalized, you can think of some good software examples yourself.&lt;br /&gt;Decorators, Composites and Adapters&lt;br /&gt;The decorator and adapter patterns are similar. Adapters also seem to decorate the classes. The intent of using adapter is to convert the interface of one or more classes to suit the interface of the client program. In case of decorator, the intent is to add behavior and functionality to some of the objects, not all the objects or adding different functionalities to each of the objects.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;In case of composite objects, the client program treats the objects similarly, whether it is a simple or complex object (nodes). &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;The decorator pattern provides functionality to objects in a more flexible way rather than inheriting from them. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;There is however disadvantage of using decorator. The disadvantage is that the code maintenance can be a problem as it provides the system with a lot of similar looking small objects (each decorator).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=""&gt;Structural Patterns - Facade Pattern&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoBodyText"&gt;&lt;span style=""&gt;Facade as the name suggests means the face of the building. The people walking past the road can only see this glass face of the building. They do not know anything about it, the wiring, the pipes and other complexities. The face hides all the complexities of the building and displays a friendly face.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;This is how facade pattern is used. It hides the complexities of the system and provides an interface to the client from where the client can access the system. In Java, the interface JDBC can be called a facade. We as users or clients create connection using the “java.sql.Connection” interface, the implementation of which we are not concerned about. The implementation is left to the vendor of driver.&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Let’s try and understand the facade pattern better using a simple example. Let’s consider a store. This store has a store keeper. In the storage, there are a lot of things stored e.g. packing material, raw material and finished goods.&lt;br /&gt;&lt;br /&gt;You, as client want access to different goods. You do not know where the different materials are stored. You just have access to store keeper who knows his store well. Whatever you want, you tell the store keeper and he takes it out of store and hands it over to you on showing him the credentials. Here, the storekeeper acts as the facade, as he hides the complexities of the system Store.&lt;br /&gt;&lt;br /&gt;Let us see how the Store example works.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style=""&gt;Store.java&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package structural.facade; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public interface Store {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" valign="top" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public Goods getGoods();&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of interface&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;The store can very well be an interface. This only returns Goods. The goods are of three types as discussed earlier in this document. RawMaterialGoods, FinishedGoods and PackagingMaterialsGoods. All these classes can implement the Goods interface.&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Similarly, the stores are of three types and can implement the Store interface. Let’s have a look at the code for one of the stores.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style=""&gt;FinishedGoodsStore.java&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package structural.facade; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public class FinishedGoodsStore   implements Store {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" valign="top" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public Goods getGoods() {&lt;br /&gt;  FinishedGoods finishedGoods = new FinishedGoods();&lt;br /&gt;  return finishedGoods;&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 14.25pt;"&gt;   &lt;td colspan="2" style="padding: 0.75pt; height: 14.25pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Now let’s consider the facade StoreKeeper.&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=""&gt;StoreKeeper.java &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package structural.facade; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public class StoreKeeper {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" valign="top" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * The raw materials are asked for and&lt;br /&gt;  * are returned&lt;br /&gt;  *&lt;br /&gt;  * @return raw materials&lt;br /&gt;  */&lt;br /&gt;  public RawMaterialGoods getRawMaterialGoods() {&lt;br /&gt;  RawMaterialStore store = new RawMaterialStore();&lt;br /&gt;  RawMaterialGoods rawMaterialGoods = (RawMaterialGoods)store.getGoods();&lt;br /&gt;  return rawMaterialGoods;&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;br /&gt;  /**&lt;br /&gt;  * The packaging materials are asked for and&lt;br /&gt;  * are returned&lt;br /&gt;  *&lt;br /&gt;  * @return packaging materials&lt;br /&gt;  */&lt;br /&gt;  public PackingMaterialGoods getPackingMaterialGoods() {&lt;br /&gt;  PackingMaterialStore store = new PackingMaterialStore();&lt;br /&gt;  PackingMaterialGoods packingMaterialGoods =   (PackingMaterialGoods)store.getGoods();&lt;br /&gt;  return packingMaterialGoods;&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;br /&gt;  /**&lt;br /&gt;  * The finished goods are asked for and&lt;br /&gt;  * are returned&lt;br /&gt;  *&lt;br /&gt;  * @return finished goods&lt;br /&gt;  */&lt;br /&gt;  public FinishedGoods getFinishedGoods() {&lt;br /&gt;  FinishedGoodsStore store = new FinishedGoodsStore();&lt;br /&gt;  FinishedGoods finishedGoods = (FinishedGoods)store.getGoods();&lt;br /&gt;  return finishedGoods;&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 14.25pt;"&gt;   &lt;td colspan="2" style="padding: 0.75pt; height: 14.25pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;This is clear that Storekeeper himself will do the complex implementation. The client will just access the Storekeeper and ask for finished goods, packaging material or raw material.&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;How will the client program access this façade? Here is a simple code.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style=""&gt;Client.java &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package structural.facade; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public class Client {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" valign="top" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * to get raw materials&lt;br /&gt;  */&lt;br /&gt;  public static void main(String[] args) {&lt;br /&gt;  StoreKeeper keeper = new StoreKeeper();&lt;br /&gt;  RawMaterialGoods rawMaterialGoods = keeper.getRawMaterialGoods();&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 14.25pt;"&gt;   &lt;td colspan="2" style="padding: 0.75pt; height: 14.25pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;In this way the implementation is left to the façade. The client is given just one interface and can access only that. This hides all the complexities.&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;There is another way of implementing this. We can have just one method in our StoreKeeper class getGoods(String goodsType).&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Another version of StoreKeeper method is here.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style=""&gt;StoreKeeper.java &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package structural.facade; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;public class StoreKeeper {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 10%;" width="10%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 90%;" valign="top" width="90%"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * The common method&lt;br /&gt;  *&lt;br /&gt;  * @return Goods&lt;br /&gt;  */&lt;br /&gt;  public Goods getGoods(String goodsType) {&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;if   (goodsType.equals("Packaging")) {&lt;br /&gt;  PackingMaterialStore store = new PackingMaterialStore();&lt;br /&gt;  PackingMaterialGoods packingMaterialGoods =   (PackingMaterialGoods)store.getGoods();&lt;br /&gt;  return packingMaterialGoods;&lt;br /&gt;  }&lt;br /&gt;  else if (goodsType.equals("Finished")) {&lt;br /&gt;  FinishedGoodsStore store = new FinishedGoodsStore();&lt;br /&gt;  FinishedGoods finishedGoods = (FinishedGoods)store.getGoods();&lt;br /&gt;  return finishedGoods;&lt;br /&gt;  }&lt;br /&gt;  else {&lt;br /&gt;  RawMaterialStore store = new RawMaterialStore();&lt;br /&gt;  RawMaterialGoods rawMaterialGoods = (RawMaterialGoods)store.getGoods();&lt;br /&gt;  return rawMaterialGoods;&lt;br /&gt;  }&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 14.25pt;"&gt;   &lt;td colspan="2" style="padding: 0.75pt; height: 14.25pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}// End of class&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;The client program can now create an object of StoreKeeper class and call method getGoods() passing as parameter the type of goods required. This can be done as follows.&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=""&gt;new StoreKeeper().getGoods(“RawMaterials”);&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;In this case, the type-casting ill be needed on client side to narrow down Goods to RawMaterialsGoods.&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;All in all, the Façade pattern hides the complexities of system from the client and provides a simpler interface. Looking from other side, the facade also provides the implementation to be changed without affecting the client code.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style=""&gt;Structural Patterns - Flyweight Pattern&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;The pattern here states about a mechanism by which you can avoid creating a large number of object instances to represent the entire system. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;To decide if some part of your program is a candidate for using Flyweights, consider whether it is possible to remove some data from the class and make it extrinsic. If this makes it possible to reduce greatly the number of different class instances your program needs to maintain, this might be a case where Flyweights will help.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;The typical example you can see on this in every book will be of folders. The folder with name of each of the company employee on it, so, the attributes of class Folder are: ‘Selected’, ‘Not Selected’ and the third one is ‘employeeName’. With this methodology, we will have to create 2000 folder class instances for each of the employees. This can be costly, so we can create just two class instances with attributes ‘selected’ and ‘not selected’ and set the employee’s name by a method like:&lt;br /&gt;&lt;br /&gt;setNameOnFolder(String name);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;This way, the instances of class folder will be shared and you will not have to create multiple instances for each employee.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;I was going through this pattern and was trying to find the best suited non-software example. Then, I remembered the talks I had with one of my cousin’s who used to work in a grinding wheel manufacturing company. I am a Chemical Engineer and so, remember the names of chemical compounds. He was telling me that the grinding wheels are used for metal cutting across the industry. Basically the main ingredients for these grinding wheels are Aluminum Oxide (Al2O3) and Silicon Carbide (SiC). These compounds are used in form of grains. For those who remember Chemistry from schools, and for others, just follow the example. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;His company manufactures nearly 25000 types of grinding wheels. Now, there is another technicality in this and that is bonding.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;There are two types of bondings used to bond the material i.e. Aluminum Oxide and Silicon Carbide together. One is Glass bonding – this is like, the wheel is heated to 1300 degree C and the silicon turns into glass to hold the two materials together. The second type of bonding is Resin bonding, this is when some resins help in holding the materials together. The wheels are in different sizes, have different ratio of materials mixed and have any of these two types of bondings. This decides the strength of the wheel. In all, creating 25,000 types of combinations is a pretty complex looking scenario.&lt;br /&gt;&lt;br /&gt;If we consider this from software point of view, we can see that each wheel is of a different type and so, we need to make 25000 classes for taking care of each of the wheel. This of course will be very resource intensive. So, how to avoid this?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Well, we already know a few things and we can see a common pattern in each of the wheels. The common things are as follows:&lt;br /&gt;&lt;br /&gt;1. Materials of use – They are always Aluminum Oxide and Silicon Carbide.&lt;br /&gt;2. Each wheel has a bonding.&lt;br /&gt;3. Each wheel has a size.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;We can follow one thing, the combination above mentioned three ingredients can give us a large number of instances so, why not take a scenario where only one of these is used in the constructor and rest be passed as method parameters. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Let’s have a look at the code. For every flyweight, there is a factory providing the object instance. Now, naturally wheels are made in a factory so, there is GrindingWheelFactory class which returns the type of wheel needed.&lt;br /&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style=""&gt;GrindingWheelFactory.java&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="2" style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;package   structural.flyweight;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;/**&lt;br /&gt;  * This factory of wheel is accessed by the client. Everytime,&lt;br /&gt;  * the client wants a wheel, the softw
