<?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:blogger='http://schemas.google.com/blogger/2008' 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-9030977462820689825</id><updated>2026-10-02T09:29:52.595-04:00</updated><category term="CGI"/><category term="HTML"/><category term="HTTP"/><category term="Interface"/><category term="InterruptedException"/><category term="JSP"/><category term="JSP page"/><category term="Java Servlet"/><category term="ServletRequest"/><category term="client"/><category term="constructor"/><category term="exception"/><category term="implicit objects"/><category term="init()"/><category term="javax"/><category term="security"/><category term="servlet"/><category term="servlet lifecycle"/><category term="servlets"/><category term="sleep()"/><title type='text'>Java Today</title><subtitle type='html'>J2SE, J2EE information blog including: Spring, Servlets, JSP, etc.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://techs4.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://techs4.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Gagandeep Singh</name><uri>http://www.blogger.com/profile/01502339043741247951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>22</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-9030977462820689825.post-2908864507327939135</id><published>2016-09-15T01:34:00.000-04:00</published><updated>2016-09-15T01:34:00.812-04:00</updated><title type='text'>Software Support &amp; Development for Students, Shops and Companies</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;All types of Software Applications and Android Apps can be developed and designed:&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjwjiTSTQ8eUgSMCcHvh_f535yuH5HBHNat3eQzEpTOt2QCDIVVv4Mv49wUfaGHzoJnEIp4pz4HnGVJLpB1ZrN16V9XJEDKkogPP2koFlJNqMHJAY_cKdzqCChdbPCxOZ122HNunLRSw6P/s1600/Capture.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;385&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjwjiTSTQ8eUgSMCcHvh_f535yuH5HBHNat3eQzEpTOt2QCDIVVv4Mv49wUfaGHzoJnEIp4pz4HnGVJLpB1ZrN16V9XJEDKkogPP2koFlJNqMHJAY_cKdzqCChdbPCxOZ122HNunLRSw6P/s640/Capture.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;background-color: #cccccc; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style=&quot;background-color: #cccccc; font-size: large;&quot;&gt;1. Student&#39;s Vacation software projects&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;background-color: #cccccc; font-size: large;&quot;&gt;2. Management related software&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;background-color: #cccccc; font-size: large;&quot;&gt;3. Billing Softwares&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;background-color: #cccccc; font-size: large;&quot;&gt;4. Inventory related softwares&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;background-color: #cccccc; font-size: large;&quot;&gt;5. College software projects&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;background-color: #cccccc; font-size: large;&quot;&gt;and many more....&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://techs4.blogspot.com/feeds/2908864507327939135/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techs4.blogspot.com/2016/09/software-support-development-for.html#comment-form' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/2908864507327939135'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/2908864507327939135'/><link rel='alternate' type='text/html' href='http://techs4.blogspot.com/2016/09/software-support-development-for.html' title='Software Support &amp; Development for Students, Shops and Companies'/><author><name>Gagandeep Singh</name><uri>http://www.blogger.com/profile/01502339043741247951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjwjiTSTQ8eUgSMCcHvh_f535yuH5HBHNat3eQzEpTOt2QCDIVVv4Mv49wUfaGHzoJnEIp4pz4HnGVJLpB1ZrN16V9XJEDKkogPP2koFlJNqMHJAY_cKdzqCChdbPCxOZ122HNunLRSw6P/s72-c/Capture.PNG" height="72" width="72"/><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9030977462820689825.post-4117961095500249540</id><published>2016-07-05T07:06:00.002-04:00</published><updated>2019-06-04T23:13:24.487-04:00</updated><title type='text'>Spring and RESTful webservice Integration</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;b&gt;&lt;u&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Spring and RESTful webservice Integration&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;b&gt;&lt;u&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Earlier, we had developed an application using Spring and Rest. But, this is a basic app which shows integration of Spring with Rest at a beginner level. This demo app is for freshers.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHEztsFSaNRwE6lvvW19kCoOId8LlGAL-YN5Dd9fw1EnuQ__1Dth60IuARvgcLtRvpj4e7Yd4cAN8vS1tHoyERDWQNVLwSik5KkzixTygXMRzjgyg_swUrEHxQygf2Qy9g0RpjTOFnrXYk/s1600/Capture11.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;381&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHEztsFSaNRwE6lvvW19kCoOId8LlGAL-YN5Dd9fw1EnuQ__1Dth60IuARvgcLtRvpj4e7Yd4cAN8vS1tHoyERDWQNVLwSik5KkzixTygXMRzjgyg_swUrEHxQygf2Qy9g0RpjTOFnrXYk/s400/Capture11.PNG&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;b&gt;Following below steps to create this application:&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;b&gt;1) Libraries required:&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
spring-core 4.1.6 RELEASE&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
spring-web 4.1.6 RELEASE&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
spring-webmvc 4.1.6 RELEASE&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
jstl 1.2&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;b&gt;2) Create a xml file named as &lt;span style=&quot;color: #990000;&quot;&gt;web.xm&lt;/span&gt;l in WEB-INF folder and write following code:&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&amp;lt;!DOCTYPE web-app PUBLIC&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&amp;nbsp;&quot;-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN&quot;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&amp;nbsp;&quot;http://java.sun.com/dtd/web-app_2_3.dtd&quot; &amp;gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&amp;lt;web-app&amp;gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;display-name&amp;gt;Archetype Created Web Application&amp;lt;/display-name&amp;gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;servlet&amp;gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;servlet-name&amp;gt;springrest&amp;lt;/servlet-name&amp;gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;servlet-class&amp;gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;org.springframework.web.servlet.DispatcherServlet&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;/servlet-class&amp;gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;load-on-startup&amp;gt;1&amp;lt;/load-on-startup&amp;gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/servlet&amp;gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;servlet-mapping&amp;gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;servlet-name&amp;gt;springrest&amp;lt;/servlet-name&amp;gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;url-pattern&amp;gt;/&amp;lt;/url-pattern&amp;gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/servlet-mapping&amp;gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&amp;lt;/web-app&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;3) Create a xml file named as &lt;span style=&quot;color: #990000;&quot;&gt;springrest-servlet.xml&lt;/span&gt; in WEB-INF folder and write following code in it:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&amp;lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;xmlns:context=&quot;http://www.springframework.org/schema/context&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;xmlns:mvc=&quot;http://www.springframework.org/schema/mvc&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;xsi:schemaLocation=&quot; http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;mvc:annotation-driven /&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;context:component-scan base-package=&quot;com.gag.controller&quot; /&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;/beans&amp;gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;4) Create a package named as &lt;span style=&quot;color: #990000;&quot;&gt;com.gag.controller&lt;/span&gt; and Create a class named as&amp;nbsp;&lt;span style=&quot;color: #990000;&quot;&gt;SpringRestController.java&lt;/span&gt; and write following code in it:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
package com.gag.controller;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
import org.springframework.web.bind.annotation.PathVariable;&lt;/div&gt;
&lt;div&gt;
import org.springframework.web.bind.annotation.RequestMapping;&lt;/div&gt;
&lt;div&gt;
import org.springframework.web.bind.annotation.RequestMethod;&lt;/div&gt;
&lt;div&gt;
import org.springframework.web.bind.annotation.RestController;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
@RestController&lt;/div&gt;
&lt;div&gt;
@RequestMapping(&quot;/hello&quot;)&lt;/div&gt;
&lt;div&gt;
public class SpringRestController {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;@RequestMapping(value = &quot;/{name}&quot;, method = RequestMethod.GET)&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public String hello(@PathVariable String name) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;String result = &quot;Hello &quot; + name;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return result;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
}&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;5) Create a JSP or any html file and write following code in it:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&amp;lt;html&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;body&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;a href=&quot;hello/Gagan&quot;&amp;gt;Say Hello&amp;lt;/a&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;/body&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;/html&amp;gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Our output would be like as below:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwIg5HvJRPPHVFcJ1SYa-JZxgCrJqkyQlnJCma-mkr9qCCZqXUZzMYe9mvHWYNFfoQbehV96MEWnc3gdCTqM_jANDbfOqWOpcsEATvkulXcYuXNX3-bxVqka3V7z_0olE4VYL1zNauDG4D/s1600/Capture22.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;137&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwIg5HvJRPPHVFcJ1SYa-JZxgCrJqkyQlnJCma-mkr9qCCZqXUZzMYe9mvHWYNFfoQbehV96MEWnc3gdCTqM_jANDbfOqWOpcsEATvkulXcYuXNX3-bxVqka3V7z_0olE4VYL1zNauDG4D/s640/Capture22.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;b&gt;This is an anchor tag on which you would click and a Hello Message is shown:&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcXmKWyUZ-0ZgeHehidCRqw1NEpxeqqQL-uc7NdMebGSyS5nTe6EKtOWsGLkXmYwU6EXVTop9mywmVsVxOVZNQFs7vM5HHaCgMkngmzym_3erqiO4mCe0hjZDrYG6ioKHVhqmWKyHqA5ks/s1600/Capture2222.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;140&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcXmKWyUZ-0ZgeHehidCRqw1NEpxeqqQL-uc7NdMebGSyS5nTe6EKtOWsGLkXmYwU6EXVTop9mywmVsVxOVZNQFs7vM5HHaCgMkngmzym_3erqiO4mCe0hjZDrYG6ioKHVhqmWKyHqA5ks/s640/Capture2222.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://techs4.blogspot.com/feeds/4117961095500249540/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techs4.blogspot.com/2016/07/spring-and-restful-webservice.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/4117961095500249540'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/4117961095500249540'/><link rel='alternate' type='text/html' href='http://techs4.blogspot.com/2016/07/spring-and-restful-webservice.html' title='Spring and RESTful webservice Integration'/><author><name>Gagandeep Singh</name><uri>http://www.blogger.com/profile/01502339043741247951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHEztsFSaNRwE6lvvW19kCoOId8LlGAL-YN5Dd9fw1EnuQ__1Dth60IuARvgcLtRvpj4e7Yd4cAN8vS1tHoyERDWQNVLwSik5KkzixTygXMRzjgyg_swUrEHxQygf2Qy9g0RpjTOFnrXYk/s72-c/Capture11.PNG" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9030977462820689825.post-5886246001024018882</id><published>2016-06-29T05:59:00.002-04:00</published><updated>2019-06-04T23:14:05.790-04:00</updated><title type='text'>RESTful webservice along with Spring 4 and AngularJS</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
In our earlier post, we developed a small application using REST and AngularJS. Follow this link for help &lt;a href=&quot;http://techs4.blogspot.in/2016/06/restful-webservice-using-jersey.html&quot;&gt;http://techs4.blogspot.in/2016/06/restful-webservice-using-jersey.html&lt;/a&gt;&amp;nbsp;Now, we are going to use Spring 4 to handle REST as it is used now a days in most IT-Software projects.&lt;br /&gt;
&lt;br /&gt;
We would be using Spring Controller to handle REST request/response. In Spring 4, there is a new concept of @RestController Annotation.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Overview&amp;nbsp;of our application:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiz5zIyGli7uBP2DBrwQ1ZZS2Ym8MCqBBkVA-eJsdEmYDrqlDx55I-qse8EqBQfCusDIXIAlRdZGwGbAZ5dcSDGvLOmVYxlrEBRvPQqiLqhJbrkYaIZVOiDrJp8gX6Igseif9B4j8sXLKnt/s1600/ii1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;227&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiz5zIyGli7uBP2DBrwQ1ZZS2Ym8MCqBBkVA-eJsdEmYDrqlDx55I-qse8EqBQfCusDIXIAlRdZGwGbAZ5dcSDGvLOmVYxlrEBRvPQqiLqhJbrkYaIZVOiDrJp8gX6Igseif9B4j8sXLKnt/s640/ii1.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Our front-end would look like as below:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEji5fmWPkc6sgkgvyTrJ-zMY4Zu3h3Daq4J2tBbNzztOjaBBQL9iwY0no5dU9-O2Xt0NYeOuTvr7EB-eDd6w0EJSyqGVG6HX7UuN5uqrwuWnKsym-aTSTTqah_mRM71yiJl0ZNQY8GaCPWl/s1600/iii22.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;247&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEji5fmWPkc6sgkgvyTrJ-zMY4Zu3h3Daq4J2tBbNzztOjaBBQL9iwY0no5dU9-O2Xt0NYeOuTvr7EB-eDd6w0EJSyqGVG6HX7UuN5uqrwuWnKsym-aTSTTqah_mRM71yiJl0ZNQY8GaCPWl/s640/iii22.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Follow below steps to create this small application:&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;a) Libraries required:&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
jersey-server 1.9&lt;br /&gt;
mysql-connector-java 5.1.10&lt;br /&gt;
com.google.code.gson (gson) 2.2.1&lt;br /&gt;
spring-core 4.1.6&lt;br /&gt;
spring-web 4.1.6&lt;br /&gt;
spring-webmvc 4.1.6&lt;br /&gt;
javax.servlet-api 3.1.0&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;b) Create a xml file named as &lt;span style=&quot;color: #990000;&quot;&gt;spring-servlet.xml&lt;/span&gt; in WEB-INF folder and write following code in it:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;xmlns:context=&quot;http://www.springframework.org/schema/context&quot;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;xmlns:mvc=&quot;http://www.springframework.org/schema/mvc&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;xsi:schemaLocation=&quot; http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd&quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;mvc:annotation-driven /&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;context:component-scan base-package=&quot;com.gag&quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/beans&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;c) Create another xml file named as &lt;span style=&quot;color: #990000;&quot;&gt;web.xml&lt;/span&gt; in WEB-INF folder and write following code in it:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!DOCTYPE web-app PUBLIC&lt;br /&gt;
&amp;nbsp;&quot;-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN&quot;&lt;br /&gt;
&amp;nbsp;&quot;http://java.sun.com/dtd/web-app_2_3.dtd&quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;web-app&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;lt;display-name&amp;gt;Archetype Created Web Application&amp;lt;/display-name&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;lt;servlet&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;servlet-name&amp;gt;spring&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;servlet-class&amp;gt;org.springframework.web.servlet.DispatcherServlet&amp;lt;/servlet-class&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;load-on-startup&amp;gt;1&amp;lt;/load-on-startup&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/servlet&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;servlet-mapping&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;servlet-name&amp;gt;spring&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;url-pattern&amp;gt;/&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt;
&amp;lt;/web-app&amp;gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;d) Create a properties file named as &lt;span style=&quot;color: #990000;&quot;&gt;configuration.properties&lt;/span&gt; and write following code in it:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
jdbc.driver = com.mysql.jdbc.Driver&lt;/div&gt;
&lt;div&gt;
jdbc.url = jdbc:mysql:///um&lt;/div&gt;
&lt;div&gt;
jdbc.user = root&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;e) Create a package named as &lt;span style=&quot;color: #990000;&quot;&gt;com.gag&amp;nbsp;&lt;/span&gt;and within this package Create a class (POJO) named as &lt;span style=&quot;color: #990000;&quot;&gt;Customer.java&lt;/span&gt; in it:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
package com.gag;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
public class Customer {&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private Integer id;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private String name, email;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public String getName() {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return name;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public Integer getId() {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return id;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void setId(Integer id) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;this.id = id;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void setName(String name) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;this.name = name;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public String getEmail() {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return email;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void setEmail(String email) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;this.email = email;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
}&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;f) Create a class named as &lt;span style=&quot;color: #990000;&quot;&gt;ReadFromPropertiesFile.java&lt;/span&gt; in which following code is to be written:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
package com.gag;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
import java.io.InputStream;&lt;/div&gt;
&lt;div&gt;
import java.util.Properties;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
public class ReadFromPropertiesFile {&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Properties properties = null;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;ReadFromPropertiesFile() {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;InputStream is = ReadFromPropertiesFile.class.getClassLoader()&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;.getResourceAsStream(&quot;configuration.properties&quot;);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;properties = new Properties();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;properties.load(is);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} catch (Exception e) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;System.out.println(&quot;aaaa &quot; + e);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public String getURL() {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;return properties.getProperty(&quot;jdbc.url&quot;);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} catch (Exception e) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;System.out.println(&quot;getURL:&quot; + e);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return &quot;&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
}&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;g) Create another class named as &lt;span style=&quot;color: #990000;&quot;&gt;ConnectDB.java&lt;/span&gt; in which database connectivity is performed:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
package com.gag;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
import java.sql.Connection;&lt;/div&gt;
&lt;div&gt;
import java.sql.DriverManager;&lt;/div&gt;
&lt;div&gt;
import java.util.logging.Logger;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
public class ConnectDB {&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;static ReadFromPropertiesFile obj = new ReadFromPropertiesFile();&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static Connection connect() {&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Connection conn = null;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Class.forName(&quot;com.mysql.jdbc.Driver&quot;);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;conn = DriverManager.getConnection(obj.getURL(), &quot;root&quot;, &quot;&quot;);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} catch (Exception e) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Logger.getLogger(ConnectDB.class + &quot;&quot;);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return conn;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
}&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;h) Create a service layer class named as &lt;span style=&quot;color: #990000;&quot;&gt;CustomerServices.java&lt;/span&gt; and write following code in it:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
package com.gag;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
import java.sql.Connection;&lt;/div&gt;
&lt;div&gt;
import java.sql.PreparedStatement;&lt;/div&gt;
&lt;div&gt;
import java.sql.ResultSet;&lt;/div&gt;
&lt;div&gt;
import java.util.ArrayList;&lt;/div&gt;
&lt;div&gt;
import java.util.List;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
public class CustomerServices {&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public List&amp;lt;Customer&amp;gt; getAllCustomers() {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;List&amp;lt;Customer&amp;gt; lst = new ArrayList();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Connection conn = ConnectDB.connect();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;PreparedStatement pstmt = conn&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;.prepareStatement(&quot;select * from customer order by id&quot;);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;ResultSet rs = pstmt.executeQuery();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;while (rs.next()) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;Customer obj = new Customer();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;obj.setId(rs.getInt(&quot;id&quot;));&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;obj.setName(rs.getString(&quot;name&quot;));&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;obj.setEmail(rs.getString(&quot;email&quot;));&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;lst.add(obj);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} catch (Exception e) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;System.out.println(e);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return lst;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public String addCustomer(Customer obj) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Connection conn = ConnectDB.connect();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;PreparedStatement pstmt = conn&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;.prepareStatement(&quot;insert into customer values(?,?,?)&quot;);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;pstmt.setInt(1, obj.getId());&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;pstmt.setString(2, obj.getName());&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;pstmt.setString(3, obj.getEmail());&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;int i = pstmt.executeUpdate();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if (i &amp;gt; 0) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;return &quot;Customer Created&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} catch (Exception e) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;System.out.println(&quot;addCustomer: &quot; + e);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return &quot;Failed to &amp;nbsp;Create Customer&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public String updateCustomer(Customer obj) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Connection conn = ConnectDB.connect();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;PreparedStatement pstmt = conn&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;.prepareStatement(&quot;update customer set name=?,email = ? where id = ?&quot;);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;pstmt.setString(1, obj.getName());&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;pstmt.setString(2, obj.getEmail());&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;pstmt.setInt(3, obj.getId());&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;int i = pstmt.executeUpdate();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if (i &amp;gt; 0) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;return &quot;Customer Updated&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} catch (Exception e) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;System.out.println(&quot;updateCustomer: &quot; + e);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return &quot;Failed to &amp;nbsp;Update Customer&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public String delCustomer(int id) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Connection conn = ConnectDB.connect();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;PreparedStatement pstmt = conn&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;.prepareStatement(&quot;delete from customer where id = ?&quot;);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;pstmt.setInt(1, id);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;int i = pstmt.executeUpdate();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if (i &amp;gt; 0) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;return &quot;Customer Deleted&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} catch (Exception e) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;System.out.println(&quot;delCustomer: &quot; + e);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return &quot;Failed to &amp;nbsp;Delete Customer&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
}&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;i) Create a class named as &lt;span style=&quot;color: #990000;&quot;&gt;CustomerAPI.java&lt;/span&gt; and write following code in it:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
package com.gag;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
import java.util.List;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
import javax.ws.rs.core.MediaType;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
import org.springframework.http.HttpStatus;&lt;/div&gt;
&lt;div&gt;
import org.springframework.http.ResponseEntity;&lt;/div&gt;
&lt;div&gt;
import org.springframework.web.bind.annotation.PathVariable;&lt;/div&gt;
&lt;div&gt;
import org.springframework.web.bind.annotation.RequestBody;&lt;/div&gt;
&lt;div&gt;
import org.springframework.web.bind.annotation.RequestMapping;&lt;/div&gt;
&lt;div&gt;
import org.springframework.web.bind.annotation.RequestMethod;&lt;/div&gt;
&lt;div&gt;
import org.springframework.web.bind.annotation.RestController;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
import com.google.gson.Gson;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
@RestController&lt;/div&gt;
&lt;div&gt;
public class CustomerAPI {&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;@RequestMapping(value = &quot;/getCustomers&quot;, method = RequestMethod.GET, produces = &quot;application/json&quot;)&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public String feed() {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;String feeds = null;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;List&amp;lt;Customer&amp;gt; lstCustomers = null;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;CustomerServices customerServices = new CustomerServices();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;lstCustomers = customerServices.getAllCustomers();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Gson gson = new Gson();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;feeds = gson.toJson(lstCustomers);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} catch (Exception e) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;System.out.println(&quot;Exception Error&quot;); // Console&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return feeds;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;@RequestMapping(value = &quot;/addCustomer&quot;, method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON)&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public ResponseEntity createCustomer(@RequestBody Customer obj) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;String result = &quot;&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;CustomerServices customerServices = new CustomerServices();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;result = customerServices.addCustomer(obj);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} catch (Exception e) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;System.out.println(&quot;Exception Error &amp;nbsp;&quot; + e); // Console&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return new ResponseEntity(HttpStatus.CREATED);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;@RequestMapping(value = &quot;/updateCustomer/id/{id}/name/{name}/email/{email}&quot;, method = RequestMethod.PUT)&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public ResponseEntity&amp;lt;String&amp;gt; updateCustomer(@PathVariable(&quot;id&quot;) int id,&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;@PathVariable(&quot;name&quot;) String name,&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;@PathVariable(&quot;email&quot;) String email) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;String result = &quot;&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;CustomerServices customerServices = new CustomerServices();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Customer obj = new Customer();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;obj.setId(id);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;obj.setName(name);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;obj.setEmail(email);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;result = customerServices.updateCustomer(obj);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} catch (Exception e) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;System.out.println(&quot;Exception Error &amp;nbsp;&quot; + e); // Console&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return new ResponseEntity&amp;lt;String&amp;gt;(HttpStatus.CREATED);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;@RequestMapping(value = &quot;/delCustomer/id/{id}&quot;, method = RequestMethod.DELETE)&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public ResponseEntity&amp;lt;String&amp;gt; delCustomer(@PathVariable(&quot;id&quot;) Integer id) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if (id &amp;gt; 0) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;String result = &quot;&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;System.out.println(&quot;Id:: &quot; + id);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;try {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;CustomerServices customerServices = new CustomerServices();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;result = customerServices.delCustomer(id);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;} catch (Exception e) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;System.out.println(&quot;Exception Error &amp;nbsp;&quot; + e); // Console&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;return new ResponseEntity&amp;lt;String&amp;gt;(HttpStatus.CREATED);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} else {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;return new ResponseEntity&amp;lt;String&amp;gt;(HttpStatus.NOT_ACCEPTABLE);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
}&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;j) Create an &lt;span style=&quot;color: #990000;&quot;&gt;index.jsp&lt;/span&gt; file and write following code in it:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&amp;lt;html&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;head&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;link rel=&quot;stylesheet&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;href=&quot;https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;script&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;script&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;src=&quot;https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;var myapp = angular.module(&quot;myApp&quot;, []);&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;myapp.controller(&quot;umcontroller&quot;, function($scope, $http) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;$scope.employees = [];&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;$scope.form = {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;id : &quot;&quot;,&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;name : &quot;&quot;,&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;email : &quot;&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;};&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;_refreshPageData();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;$scope.check = &quot;&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;$scope.submitCustomer = function() {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if ($scope.form.check == &quot;check&quot;) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;method = &quot;PUT&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;url = &#39;updateCustomer/id/&#39; + $scope.form.id + &quot;/name/&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;+ $scope.form.name + &quot;/email/&quot; + $scope.form.email;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;} else {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;method = &quot;POST&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;url = &#39;addCustomer&#39;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;$http({&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;method : method,&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;url : url,&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;data : angular.toJson($scope.form),&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;headers : {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&#39;Content-Type&#39; : &#39;application/json&#39;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}).then(function successCallback(response) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;$scope.form.check = &quot;&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;_success(response);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;});&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;};&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;$scope.removeEmployee = function(employee) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;$http({&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;method : &#39;DELETE&#39;,&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;url : &#39;delCustomer/id/&#39; + employee.id&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}).then(function successCallback(response) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;_success(response);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;});&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;};&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;$scope.editEmployee = function(employee) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;$scope.form.name = employee.name;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;$scope.form.email = employee.email;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;$scope.form.id = employee.id;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;$scope.form.check = &quot;check&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;};&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;function _refreshPageData() {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;$http({&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;method : &#39;GET&#39;,&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;url : &#39;getCustomers&#39;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}).then(function successCallback(response) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;$scope.employees = response.data;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}, function errorCallback(response) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;console.log(response.statusText);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;});&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;function _success(response) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;_refreshPageData();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;_clearForm()&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;function _error(response) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;console.log(response.statusText);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;function _clearForm() {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;$scope.form.name = &quot;&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;$scope.form.email = &quot;&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;$scope.form.id = &quot;&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;$scope.clearForm = function() {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;_clearForm();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;});&lt;/div&gt;
&lt;div&gt;
&amp;lt;/script&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;/head&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;body ng-app=&quot;myApp&quot; ng-controller=&quot;umcontroller&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;div class=&quot;generic-container&quot; ng-controller=&quot;umcontroller&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;div class=&quot;panel panel-default&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;div class=&quot;panel-heading&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&amp;lt;span class=&quot;lead&quot;&amp;gt;User Registration Form &amp;lt;/span&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;div class=&quot;formcontainer&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&amp;lt;form ng-submit=&quot;submitCustomer()&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;div class=&quot;row&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&amp;lt;input type=&quot;hidden&quot; ng-model=&quot;form.id&quot; /&amp;gt; &amp;lt;input type=&quot;hidden&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;ng-model=&quot;form.check&quot; /&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&amp;lt;div class=&quot;form-group col-md-12&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;label class=&quot;col-md-2 control-lable&quot; for=&quot;id&quot;&amp;gt;Id&amp;lt;/label&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;div class=&quot;col-md-7&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;&amp;lt;input type=&quot;text&quot; ng-model=&quot;form.id&quot; name=&quot;id&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;         &lt;/span&gt;class=&quot;username form-control input-sm&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;         &lt;/span&gt;placeholder=&quot;Enter your Id&quot; required ng-minlength=&quot;1&quot; /&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;div class=&quot;row&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&amp;lt;div class=&quot;form-group col-md-12&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;label class=&quot;col-md-2 control-lable&quot; for=&quot;name&quot;&amp;gt;Name&amp;lt;/label&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;div class=&quot;col-md-7&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;&amp;lt;input type=&quot;text&quot; ng-model=&quot;form.name&quot; id=&quot;name&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;         &lt;/span&gt;class=&quot;username form-control input-sm&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;         &lt;/span&gt;placeholder=&quot;Enter your name&quot; required ng-minlength=&quot;3&quot; /&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;div class=&quot;row&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&amp;lt;div class=&quot;form-group col-md-12&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;label class=&quot;col-md-2 control-lable&quot; for=&quot;email&quot;&amp;gt;Email&amp;lt;/label&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;div class=&quot;col-md-7&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;&amp;lt;input type=&quot;text&quot; ng-model=&quot;form.email&quot; id=&quot;email&quot; name=&quot;email&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;         &lt;/span&gt;class=&quot;form-control input-sm&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;         &lt;/span&gt;placeholder=&quot;Enter your Email [This field is validation free]&quot; /&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;div class=&quot;row&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&amp;lt;div class=&quot;form-actions floatRight&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;input type=&quot;submit&quot; value=&quot;{{!form.check ? &#39;Add&#39; : &#39;Update&#39;}}&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;class=&quot;btn-sm&quot; ng-disabled=&quot;myForm.$invalid&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;button type=&quot;button&quot; ng-click=&quot;clearForm()&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;class=&quot;btn-sm&quot;&amp;gt;Reset Form&amp;lt;/button&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&amp;lt;/form&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;div class=&quot;panel panel-default&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;!-- Default panel contents --&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;div class=&quot;panel-heading&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&amp;lt;span class=&quot;lead&quot;&amp;gt;List of Users &amp;lt;/span&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;div class=&quot;tablecontainer&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&amp;lt;table class=&quot;table table-hover&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;thead&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&amp;lt;tr&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;th&amp;gt;ID.&amp;lt;/th&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;th&amp;gt;Name&amp;lt;/th&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;th&amp;gt;Email&amp;lt;/th&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;th width=&quot;20%&quot;&amp;gt;&amp;lt;/th&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&amp;lt;/tr&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;/thead&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;tbody&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&amp;lt;tr ng-repeat=&quot;u in employees&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;td&amp;gt;&amp;lt;span ng-bind=&quot;u.id&quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;td&amp;gt;&amp;lt;span ng-bind=&quot;u.name&quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;td&amp;gt;&amp;lt;span ng-bind=&quot;u.email&quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;td&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;&amp;lt;button type=&quot;button&quot; ng-click=&quot;editEmployee(u)&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;         &lt;/span&gt;class=&quot;btn btn-success custom-width&quot;&amp;gt;Edit&amp;lt;/button&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;&amp;lt;button type=&quot;button&quot; ng-click=&quot;removeEmployee(u)&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;         &lt;/span&gt;class=&quot;btn btn-danger custom-width&quot;&amp;gt;Remove&amp;lt;/button&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;/td&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&amp;lt;/tr&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;/tbody&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&amp;lt;/table&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;/body&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;/html&amp;gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://techs4.blogspot.com/feeds/5886246001024018882/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techs4.blogspot.com/2016/06/restful-webservice-along-with-spring-4.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/5886246001024018882'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/5886246001024018882'/><link rel='alternate' type='text/html' href='http://techs4.blogspot.com/2016/06/restful-webservice-along-with-spring-4.html' title='RESTful webservice along with Spring 4 and AngularJS'/><author><name>Gagandeep Singh</name><uri>http://www.blogger.com/profile/01502339043741247951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiz5zIyGli7uBP2DBrwQ1ZZS2Ym8MCqBBkVA-eJsdEmYDrqlDx55I-qse8EqBQfCusDIXIAlRdZGwGbAZ5dcSDGvLOmVYxlrEBRvPQqiLqhJbrkYaIZVOiDrJp8gX6Igseif9B4j8sXLKnt/s72-c/ii1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9030977462820689825.post-337819948087052445</id><published>2016-06-23T05:58:00.001-04:00</published><updated>2019-06-04T23:14:47.413-04:00</updated><title type='text'>RESTful WebService using Jersey, AngularJS, MySQL (Small application to maintain users - Usermaintenance) </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;RESTful WebService using Jersey, AngularJS, MySQL&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
In this application, we will use AngularJS at the front-end and MySQL at the back-end. Moreover, Angular will communicate with database to store and fetch information using RESTful webservices. Obviously, we would be using JSON format for transfer of data from angular to rest and vice versa.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnfRN-CX3RBnX1Y0pKYQEqvcbr0V64KzBUZLEcjJEhduANCml2JASRkz_M6i3ZIM7wokmEqszEjShggY1OhSCAvLhiFT-p8vE_jIt-X-wyCHHKrjFv6d1Pp7ams9a3O5mUf4a3Juc8FRhN/s1600/img.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnfRN-CX3RBnX1Y0pKYQEqvcbr0V64KzBUZLEcjJEhduANCml2JASRkz_M6i3ZIM7wokmEqszEjShggY1OhSCAvLhiFT-p8vE_jIt-X-wyCHHKrjFv6d1Pp7ams9a3O5mUf4a3Juc8FRhN/s1600/img.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;Following some steps to achieve this task and our output will be as below:&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijJeLYq3UVCNIyh1anrdwozdOBZYnHutb-QmLDSg3T0yWOYW2oMiDcnfAslrTctZigZcUehyLxFlJb47dnE1P5OFVIb0hj8N1RU2gToKfcebG4u1Zi24oKqnj-gv1sb89NXYBpkE8BL00o/s1600/img2.png&quot; imageanchor=&quot;1&quot; style=&quot;background-color: black; margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;239&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijJeLYq3UVCNIyh1anrdwozdOBZYnHutb-QmLDSg3T0yWOYW2oMiDcnfAslrTctZigZcUehyLxFlJb47dnE1P5OFVIb0hj8N1RU2gToKfcebG4u1Zi24oKqnj-gv1sb89NXYBpkE8BL00o/s640/img2.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;b&gt;a) Libraries required:&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
jersey-server 1.9&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
mysql-connector-java 5.1.10&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
(com.google.code.gson) gson 2.2.1&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;b&gt;b) Create a property file named as configuration.properties and write following lines:&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
jdbc.driver = com.mysql.jdbc.Driver&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
jdbc.url = jdbc:mysql:///um&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
jdbc.user = root&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;b&gt;c) Create a package named as com.gag and Create a class named as &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: red;&quot;&gt;ReadFromPropertiesFile.java&lt;/span&gt; and write following lines in it:&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
package com.gag;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
import java.io.InputStream;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
import java.util.Properties;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
public class ReadFromPropertiesFile {&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Properties properties = null;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;ReadFromPropertiesFile() {&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try {&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;InputStream is = ReadFromPropertiesFile.class.getClassLoader()&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;.getResourceAsStream(&quot;configuration.properties&quot;);&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;properties = new Properties();&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;properties.load(is);&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} catch (Exception e) {&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;System.out.println(&quot;aaaa &quot; + e);&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public String getURL() {&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try {&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;return properties.getProperty(&quot;jdbc.url&quot;);&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} catch (Exception e) {&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;System.out.println(&quot;getURL:&quot; + e);&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return &quot;&quot;;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;d) Create a class named as&amp;nbsp;&lt;span style=&quot;color: red;&quot;&gt;ConnectDB.java&lt;/span&gt; and write following lines in it:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
package com.gag;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
import java.sql.Connection;&lt;/div&gt;
&lt;div&gt;
import java.sql.DriverManager;&lt;/div&gt;
&lt;div&gt;
import java.util.logging.Logger;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
public class ConnectDB {&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;static ReadFromPropertiesFile obj = new ReadFromPropertiesFile();&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static Connection connect() {&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Connection conn = null;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Class.forName(&quot;com.mysql.jdbc.Driver&quot;);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;conn = DriverManager.getConnection(obj.getURL(), &quot;root&quot;, &quot;&quot;);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} catch (Exception e) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;System.out.println(&quot;ConnectDB: &amp;nbsp;&quot; + e);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Logger.getLogger(ConnectDB.class + &quot;&quot;);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return conn;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
}&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;e) Create a POJO class named as &lt;span style=&quot;color: red;&quot;&gt;Customer.java&lt;/span&gt; and write following lines in it:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
package com.gag;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
import javax.xml.bind.annotation.XmlRootElement;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
@XmlRootElement&lt;/div&gt;
&lt;div&gt;
public class Customer {&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private int id;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private String name, email;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public int getId() {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return id;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void setId(int id) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;this.id = id;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public String getName() {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return name;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void setName(String name) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;this.name = name;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public String getEmail() {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return email;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void setEmail(String email) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;this.email = email;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;@Override&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public String toString() {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return &quot;{\&quot;id\&quot;:\&quot;&quot; + id + &quot;\&quot;,\&quot;name\&quot;:\&quot;&quot; + name + &quot;\&quot;,\&quot;email\&quot;:\&quot;&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;+ email + &quot;\&quot;}&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
}&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;f) Create a class &lt;span style=&quot;color: red;&quot;&gt;CustomerServices.java&lt;/span&gt; and write following lines in it:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
package com.gag;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
import java.sql.Connection;&lt;/div&gt;
&lt;div&gt;
import java.sql.PreparedStatement;&lt;/div&gt;
&lt;div&gt;
import java.sql.ResultSet;&lt;/div&gt;
&lt;div&gt;
import java.util.ArrayList;&lt;/div&gt;
&lt;div&gt;
import java.util.List;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
public class CustomerServices {&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public List&amp;lt;Customer&amp;gt; getAllCustomers() {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;List&amp;lt;Customer&amp;gt; lst = new ArrayList();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Connection conn = ConnectDB.connect();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;PreparedStatement pstmt = conn&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;.prepareStatement(&quot;select * from customer&quot;);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;ResultSet rs = pstmt.executeQuery();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;while (rs.next()) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;Customer obj = new Customer();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;obj.setId(rs.getInt(&quot;id&quot;));&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;obj.setName(rs.getString(&quot;name&quot;));&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;obj.setEmail(rs.getString(&quot;email&quot;));&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;lst.add(obj);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} catch (Exception e) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;System.out.println(e);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return lst;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public String addCustomer(Customer obj) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Connection conn = ConnectDB.connect();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;PreparedStatement pstmt = conn&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;.prepareStatement(&quot;insert into customer values(?,?,?)&quot;);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;pstmt.setInt(1, obj.getId());&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;pstmt.setString(2, obj.getName());&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;pstmt.setString(3, obj.getEmail());&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;int i = pstmt.executeUpdate();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if (i &amp;gt; 0) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;return &quot;{\&quot;msg\&quot;:\&quot;Customer Created\&quot;}&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} catch (Exception e) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;System.out.println(&quot;addCustomer: &quot; + e);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return &quot;{\&quot;msg\&quot;:\&quot;Failed to &amp;nbsp;Create Customer\&quot;}&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public String updateCustomer(Customer obj) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Connection conn = ConnectDB.connect();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;PreparedStatement pstmt = conn&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;.prepareStatement(&quot;update customer set name=?,email = ? where id = ?&quot;);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;pstmt.setString(1, obj.getName());&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;pstmt.setString(2, obj.getEmail());&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;pstmt.setInt(3, obj.getId());&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;int i = pstmt.executeUpdate();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if (i &amp;gt; 0) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;return &quot;{\&quot;msg\&quot;:\&quot;Customer Updated\&quot;}&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} catch (Exception e) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;System.out.println(&quot;updateCustomer: &quot; + e);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return &quot;Failed to &amp;nbsp;Update Customer&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public String delCustomer(int id) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Connection conn = ConnectDB.connect();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;PreparedStatement pstmt = conn&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;.prepareStatement(&quot;delete from customer where id = ?&quot;);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;pstmt.setInt(1, id);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;int i = pstmt.executeUpdate();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if (i &amp;gt; 0) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;return &quot;{\&quot;msg\&quot;:\&quot;Customer Deleted\&quot;}&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} catch (Exception e) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;System.out.println(&quot;delCustomer: &quot; + e);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return &quot;Failed to &amp;nbsp;Delete Customer&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
}&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;g) Create a class named as &lt;span style=&quot;color: red;&quot;&gt;CustomerAPI.java&lt;/span&gt; in which we will write our RESTful &amp;nbsp;webservice code:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
package com.gag;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
import java.util.List;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
import javax.ws.rs.DELETE;&lt;/div&gt;
&lt;div&gt;
import javax.ws.rs.GET;&lt;/div&gt;
&lt;div&gt;
import javax.ws.rs.POST;&lt;/div&gt;
&lt;div&gt;
import javax.ws.rs.PUT;&lt;/div&gt;
&lt;div&gt;
import javax.ws.rs.Path;&lt;/div&gt;
&lt;div&gt;
import javax.ws.rs.PathParam;&lt;/div&gt;
&lt;div&gt;
import javax.ws.rs.Produces;&lt;/div&gt;
&lt;div&gt;
import javax.ws.rs.core.MediaType;&lt;/div&gt;
&lt;div&gt;
import javax.ws.rs.core.Response;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
import com.google.gson.Gson;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
@Path(&quot;/customer&quot;)&lt;/div&gt;
&lt;div&gt;
public class CustomerAPI {&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;@GET&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;@Path(&quot;/getCustomers&quot;)&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;@Produces(&quot;application/json&quot;)&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public String feed() {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;String feeds = null;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;List&amp;lt;Customer&amp;gt; lstCustomers = null;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;CustomerServices customerServices = new CustomerServices();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;lstCustomers = customerServices.getAllCustomers();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Gson gson = new Gson();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;System.out.println(gson.toJson(lstCustomers));&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;feeds = gson.toJson(lstCustomers);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} catch (Exception e) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;System.out.println(&quot;Exception Error&quot;); // Console&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return feeds;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;@POST&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;@Path(&quot;/addCustomer&quot;)&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;@Produces(MediaType.APPLICATION_JSON)&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public Response createCustomer(Customer customer) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;String result = &quot;&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;CustomerServices customerServices = new CustomerServices();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;result = customerServices.addCustomer(customer);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} catch (Exception e) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;System.out.println(&quot;Exception Error &amp;nbsp;&quot; + e); // Console&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return Response.status(200).entity(result).build();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;@PUT&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;@Path(&quot;/updateCustomer/id/{id}/name/{name}/email/{email}&quot;)&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public String updateCustomer(@PathParam(&quot;id&quot;) int id,&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;@PathParam(&quot;name&quot;) String name, @PathParam(&quot;email&quot;) String email) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;String result = &quot;&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;CustomerServices customerServices = new CustomerServices();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;Customer obj = new Customer();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;obj.setId(id);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;obj.setName(name);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;obj.setEmail(email);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;result = customerServices.updateCustomer(obj);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} catch (Exception e) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;System.out.println(&quot;Exception Error &amp;nbsp;&quot; + e); // Console&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return result;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;@DELETE&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;@Path(&quot;/delCustomer/id/{id}&quot;)&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public String delCustomer(@PathParam(&quot;id&quot;) int id) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;String result = &quot;&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;CustomerServices customerServices = new CustomerServices();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;result = customerServices.delCustomer(id);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} catch (Exception e) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;System.out.println(&quot;Exception Error &amp;nbsp;&quot; + e); // Console&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return result;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
}&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;h) Create a xml file named as &lt;span style=&quot;color: red;&quot;&gt;web.xml&lt;/span&gt; and write following code in it:&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&amp;lt;!DOCTYPE web-app PUBLIC&lt;br /&gt;
&amp;nbsp;&quot;-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN&quot;&lt;br /&gt;
&amp;nbsp;&quot;http://java.sun.com/dtd/web-app_2_3.dtd&quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;web-app&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;display-name&amp;gt;Archetype Created Web Application&amp;lt;/display-name&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;servlet&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;servlet-name&amp;gt;jersey-servlet&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;servlet-class&amp;gt;com.sun.jersey.spi.container.servlet.ServletContainer&amp;lt;/servlet-class&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;init-param&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;param-name&amp;gt;com.sun.jersey.config.property.packages&amp;lt;/param-name&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;param-value&amp;gt;com.gag&amp;lt;/param-value&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;/init-param&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;load-on-startup&amp;gt;1&amp;lt;/load-on-startup&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/servlet&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;servlet-mapping&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;servlet-name&amp;gt;jersey-servlet&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;url-pattern&amp;gt;/rest/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/web-app&amp;gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;i) In the last, to use this API, we need a client, so we will use angularjs along with jquery and html. Following is the code in &lt;span style=&quot;color: red;&quot;&gt;index.jsp &lt;/span&gt;file or any html file you can create:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&amp;lt;html&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;head&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;link rel=&quot;stylesheet&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;href=&quot;https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;script&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;script&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;src=&quot;https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;var myapp = angular.module(&quot;myApp&quot;, []);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;myapp&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;.controller(&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&quot;umcontroller&quot;,&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;function($scope, $http) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;$scope.employees = [];&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;$scope.form = {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;id : &quot;&quot;,&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;name : &quot;&quot;,&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;email : &quot;&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;};&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;_refreshPageData();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;$scope.check = &quot;&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;$scope.submitCustomer = function() {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;if ($scope.form.check == &quot;check&quot;) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;method = &quot;PUT&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;url = &#39;http://localhost:8088/CustomerJerseyRestAPI/rest/customer/updateCustomer/id/&#39;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;          &lt;/span&gt;+ $scope.form.id&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;          &lt;/span&gt;+ &quot;/name/&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;          &lt;/span&gt;+ $scope.form.name&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;          &lt;/span&gt;+ &quot;/email/&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;          &lt;/span&gt;+ $scope.form.email;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;} else {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;method = &quot;POST&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;url = &#39;http://localhost:8088/CustomerJerseyRestAPI/rest/customer/addCustomer&#39;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;$http({&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;method : method,&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;url : url,&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;data : angular.toJson($scope.form),&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;headers : {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;         &lt;/span&gt;&#39;Content-Type&#39; : &#39;application/json&#39;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;}).then(function successCallback(response) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;$scope.form.check = &quot;&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;_success(response);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;}, function errorCallback(response) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;alert(&quot;ERROE:: &quot; + response);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;});&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;};&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;$scope.removeEmployee = function(employee) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;$http(&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;         &lt;/span&gt;{&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;          &lt;/span&gt;method : &#39;DELETE&#39;,&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;          &lt;/span&gt;url : &#39;http://localhost:8088/CustomerJerseyRestAPI/rest/customer/delCustomer/id/&#39;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;            &lt;/span&gt;+ employee.id&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;         &lt;/span&gt;}).then(function successCallback(response) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;_success(response);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;}, function errorCallback(response) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;alert(&quot;ERROE:: &quot; + response);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;});&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;};&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;$scope.editEmployee = function(employee) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;$scope.form.name = employee.name;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;$scope.form.email = employee.email;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;$scope.form.id = employee.id;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;$scope.form.check = &quot;check&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;};&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;function _refreshPageData() {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;$http(&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;         &lt;/span&gt;{&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;          &lt;/span&gt;method : &#39;GET&#39;,&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;          &lt;/span&gt;url : &#39;http://localhost:8088/CustomerJerseyRestAPI/rest/customer/getCustomers/&#39;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;         &lt;/span&gt;}).then(function successCallback(response) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;$scope.employees = response.data;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;}, function errorCallback(response) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;console.log(response.statusText);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;});&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;function _success(response) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;_refreshPageData();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;_clearForm()&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;function _error(response) {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;console.log(response.statusText);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;function _clearForm() {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;$scope.form.name = &quot;&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;$scope.form.email = &quot;&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;$scope.form.id = &quot;&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;$scope.clearForm = function() {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;_clearForm();&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;});&lt;/div&gt;
&lt;div&gt;
&amp;lt;/script&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;/head&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;body ng-app=&quot;myApp&quot; ng-controller=&quot;umcontroller&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;div class=&quot;generic-container&quot; ng-controller=&quot;umcontroller&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;div class=&quot;panel panel-default&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;div class=&quot;panel-heading&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&amp;lt;span class=&quot;lead&quot;&amp;gt;Usermaintenance&amp;lt;/span&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;div class=&quot;formcontainer&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&amp;lt;form ng-submit=&quot;submitCustomer()&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;div class=&quot;row&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&amp;lt;input type=&quot;hidden&quot; ng-model=&quot;form.id&quot; /&amp;gt; &amp;lt;input type=&quot;hidden&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;ng-model=&quot;form.check&quot; /&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&amp;lt;div class=&quot;form-group col-md-12&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;label class=&quot;col-md-2 control-lable&quot; for=&quot;id&quot;&amp;gt;Id&amp;lt;/label&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;div class=&quot;col-md-7&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;&amp;lt;input type=&quot;text&quot; ng-model=&quot;form.id&quot; name=&quot;id&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;         &lt;/span&gt;class=&quot;username form-control input-sm&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;         &lt;/span&gt;placeholder=&quot;Enter your Id&quot; required ng-minlength=&quot;1&quot; /&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;div class=&quot;row&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&amp;lt;div class=&quot;form-group col-md-12&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;label class=&quot;col-md-2 control-lable&quot; for=&quot;name&quot;&amp;gt;Name&amp;lt;/label&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;div class=&quot;col-md-7&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;&amp;lt;input type=&quot;text&quot; ng-model=&quot;form.name&quot; id=&quot;name&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;         &lt;/span&gt;class=&quot;username form-control input-sm&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;         &lt;/span&gt;placeholder=&quot;Enter your name&quot; required ng-minlength=&quot;3&quot; /&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;div class=&quot;row&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&amp;lt;div class=&quot;form-group col-md-12&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;label class=&quot;col-md-2 control-lable&quot; for=&quot;email&quot;&amp;gt;Email&amp;lt;/label&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;div class=&quot;col-md-7&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;&amp;lt;input type=&quot;text&quot; ng-model=&quot;form.email&quot; id=&quot;email&quot; name=&quot;email&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;         &lt;/span&gt;class=&quot;form-control input-sm&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;         &lt;/span&gt;placeholder=&quot;Enter your Email [This field is validation free]&quot; /&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;div class=&quot;row&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&amp;lt;div class=&quot;form-actions floatRight&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;input type=&quot;submit&quot; value=&quot;{{!form.check ? &#39;Add&#39; : &#39;Update&#39;}}&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;class=&quot;btn-sm&quot; ng-disabled=&quot;myForm.$invalid&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;button type=&quot;button&quot; ng-click=&quot;clearForm()&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;class=&quot;btn-sm&quot;&amp;gt;Reset Form&amp;lt;/button&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&amp;lt;/form&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;div class=&quot;panel panel-default&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;div class=&quot;panel-heading&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&amp;lt;span class=&quot;lead&quot;&amp;gt;Users&amp;lt;/span&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;div class=&quot;tablecontainer&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&amp;lt;table class=&quot;table table-hover&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;thead&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&amp;lt;tr&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;th&amp;gt;ID.&amp;lt;/th&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;th&amp;gt;Name&amp;lt;/th&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;th&amp;gt;Email&amp;lt;/th&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;th width=&quot;20%&quot;&amp;gt;&amp;lt;/th&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&amp;lt;/tr&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;/thead&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;tbody&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&amp;lt;tr ng-repeat=&quot;u in employees&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;td&amp;gt;&amp;lt;span ng-bind=&quot;u.id&quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;td&amp;gt;&amp;lt;span ng-bind=&quot;u.name&quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;td&amp;gt;&amp;lt;span ng-bind=&quot;u.email&quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;td&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;&amp;lt;button type=&quot;button&quot; ng-click=&quot;editEmployee(u)&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;         &lt;/span&gt;class=&quot;btn btn-success custom-width&quot;&amp;gt;Edit&amp;lt;/button&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;        &lt;/span&gt;&amp;lt;button type=&quot;button&quot; ng-click=&quot;removeEmployee(u)&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;         &lt;/span&gt;class=&quot;btn btn-danger custom-width&quot;&amp;gt;Remove&amp;lt;/button&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;       &lt;/span&gt;&amp;lt;/td&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;&amp;lt;/tr&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;&amp;lt;/tbody&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&amp;lt;/table&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;/body&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;/html&amp;gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://techs4.blogspot.com/feeds/337819948087052445/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techs4.blogspot.com/2016/06/restful-webservice-using-jersey.html#comment-form' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/337819948087052445'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/337819948087052445'/><link rel='alternate' type='text/html' href='http://techs4.blogspot.com/2016/06/restful-webservice-using-jersey.html' title='RESTful WebService using Jersey, AngularJS, MySQL (Small application to maintain users - Usermaintenance) '/><author><name>Gagandeep Singh</name><uri>http://www.blogger.com/profile/01502339043741247951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnfRN-CX3RBnX1Y0pKYQEqvcbr0V64KzBUZLEcjJEhduANCml2JASRkz_M6i3ZIM7wokmEqszEjShggY1OhSCAvLhiFT-p8vE_jIt-X-wyCHHKrjFv6d1Pp7ams9a3O5mUf4a3Juc8FRhN/s72-c/img.png" height="72" width="72"/><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9030977462820689825.post-9005863378609245183</id><published>2016-06-22T08:30:00.000-04:00</published><updated>2019-06-04T23:15:20.613-04:00</updated><title type='text'>Spring MVC Multiple Controller Example</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;b&gt;&lt;u&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Spring MVC Multiple Controller Example&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;u&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;u&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;a) Libraries to be used:&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
spring-core - 4.1.6&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
spring-web - 4.1.6&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
spring-webmvc - 4.1.6&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
javax.servlet-api - 3.1.0&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
jstl - 1.2&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;b) Create a xml file named as web.xml in WEB-INF folder and write the following code in it:&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&amp;lt;!DOCTYPE web-app PUBLIC&lt;br /&gt;
&amp;nbsp;&quot;-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN&quot;&lt;br /&gt;
&amp;nbsp;&quot;http://java.sun.com/dtd/web-app_2_3.dtd&quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;web-app&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;display-name&amp;gt;Archetype Created Web Application&amp;lt;/display-name&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;servlet&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;servlet-name&amp;gt;spring&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;servlet-class&amp;gt;org.springframework.web.servlet.DispatcherServlet&amp;lt;/servlet-class&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;load-on-startup&amp;gt;1&amp;lt;/load-on-startup&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/servlet&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;servlet-mapping&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;servlet-name&amp;gt;spring&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;url-pattern&amp;gt;*.html&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/web-app&amp;gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;c) Create a xml file named as spring-servlet.xml in WEB-INF folder and write following code in it:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&amp;lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:p=&quot;http://www.springframework.org/schema/p&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;xmlns:context=&quot;http://www.springframework.org/schema/context&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;xsi:schemaLocation=&quot;http://www.springframework.org/schema/beans&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; http://www.springframework.org/schema/beans/spring-beans-3.0.xsd&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; http://www.springframework.org/schema/context&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; http://www.springframework.org/schema/context/spring-context-3.0.xsd&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;context:component-scan base-package=&quot;com.gag.controller&quot; /&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;bean&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;class=&quot;org.springframework.web.servlet.view.InternalResourceViewResolver&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;property name=&quot;prefix&quot; value=&quot;/WEB-INF/jsp/&quot; /&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;property name=&quot;suffix&quot; value=&quot;.jsp&quot; /&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/bean&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;/beans&amp;gt; &amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;d) Create an index.jsp and do following code in it:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&amp;lt;html&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;body&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;h2&amp;gt;Hello World!&amp;lt;/h2&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;a href=&quot;hello.html&quot;&amp;gt;Hello Controller&amp;lt;/a&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;a href=&quot;welcome.html&quot;&amp;gt;Welcome Controller&amp;lt;/a&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;/body&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;/html&amp;gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;e) Create a folder named jsp in WEB-INF folder and Create following JSP pages in this folder:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;data.jsp&lt;/span&gt;&lt;/b&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&amp;lt;%@ page language=&quot;java&quot; contentType=&quot;text/html; charset=ISO-8859-1&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;pageEncoding=&quot;ISO-8859-1&quot;%&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;html&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;head&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=ISO-8859-1&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;title&amp;gt;Insert title here&amp;lt;/title&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;/head&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;body&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;h1&amp;gt;Hi you have arrived on Hello COntroller.....&amp;lt;/h1&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;/body&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;/html&amp;gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;and gagandeep.jsp&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&amp;lt;%@ page language=&quot;java&quot; contentType=&quot;text/html; charset=ISO-8859-1&quot;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;pageEncoding=&quot;ISO-8859-1&quot;%&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;html&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;head&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=ISO-8859-1&quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;title&amp;gt;Insert title here&amp;lt;/title&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;/head&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;body&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;h1&amp;gt;Hii..you have arrived on Welcome Controller....&amp;lt;/h1&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;/body&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;/html&amp;gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;e) Create a package named as com.gag.controller and within this package Create following classes in it:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;HelloController.java&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
package com.gag.controller;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
import org.springframework.stereotype.Controller;&lt;/div&gt;
&lt;div&gt;
import org.springframework.web.bind.annotation.RequestMapping;&lt;/div&gt;
&lt;div&gt;
import org.springframework.web.servlet.ModelAndView;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
@Controller&lt;/div&gt;
&lt;div&gt;
public class HelloController {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;@RequestMapping(&quot;/hello&quot;)&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public ModelAndView helloWorld() {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;String message = &quot;HELLO CONTROLLER&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(&quot;Heloooo..........&quot;);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return new ModelAndView(&quot;data&quot;, &quot;message&quot;, message);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
}&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;WelcomeController.java&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
package com.gag.controller;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
import org.springframework.stereotype.Controller;&lt;/div&gt;
&lt;div&gt;
import org.springframework.web.bind.annotation.RequestMapping;&lt;/div&gt;
&lt;div&gt;
import org.springframework.web.servlet.ModelAndView;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
@Controller&lt;/div&gt;
&lt;div&gt;
public class WelcomeController {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;@RequestMapping(&quot;/welcome&quot;)&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public ModelAndView helloWorld() {&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;String message = &quot;WELCOME CONTROLLER&quot;;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(&quot;Welcome.........&quot;);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return new ModelAndView(&quot;gagandeep&quot;, &quot;message&quot;, message);&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
}&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://techs4.blogspot.com/feeds/9005863378609245183/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techs4.blogspot.com/2016/06/spring-mvc-multiple-controller-example.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/9005863378609245183'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/9005863378609245183'/><link rel='alternate' type='text/html' href='http://techs4.blogspot.com/2016/06/spring-mvc-multiple-controller-example.html' title='Spring MVC Multiple Controller Example'/><author><name>Gagandeep Singh</name><uri>http://www.blogger.com/profile/01502339043741247951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9030977462820689825.post-6825884747007002310</id><published>2016-06-21T07:05:00.003-04:00</published><updated>2019-06-04T23:15:40.436-04:00</updated><title type='text'>Spring MVC Hello World</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Spring MVC HelloWorld Example&lt;br /&gt;
&lt;br /&gt;
a) Libraries required:&lt;br /&gt;
&lt;br /&gt;
spring-context - 4.1.6&lt;br /&gt;
spring-aop - 4.1.6&lt;br /&gt;
spring-webmvc - 4.1.6&lt;br /&gt;
spring-web 4.1.6&lt;br /&gt;
jstl - 1.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
b) Create web.xml file in WEB-INF folder and write following lines of code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!DOCTYPE web-app PUBLIC&lt;br /&gt;
&amp;nbsp;&quot;-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN&quot;&lt;br /&gt;
&amp;nbsp;&quot;http://java.sun.com/dtd/web-app_2_3.dtd&quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;web-app&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;display-name&amp;gt;Archetype Created Web Application&amp;lt;/display-name&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;servlet&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;servlet-name&amp;gt;spring&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;servlet-class&amp;gt;org.springframework.web.servlet.DispatcherServlet&amp;lt;/servlet-class&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;load-on-startup&amp;gt;1&amp;lt;/load-on-startup&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/servlet&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;servlet-mapping&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;servlet-name&amp;gt;spring&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;url-pattern&amp;gt;*.html&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt;
&amp;lt;/web-app&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
c) Create a xml file named as spring-servlet.xml inside WEB-INF folder and write following lines of code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;br /&gt;
&amp;lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:p=&quot;http://www.springframework.org/schema/p&quot;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;xmlns:context=&quot;http://www.springframework.org/schema/context&quot;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;xsi:schemaLocation=&quot;http://www.springframework.org/schema/beans&lt;br /&gt;
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd&lt;br /&gt;
http://www.springframework.org/schema/context&lt;br /&gt;
http://www.springframework.org/schema/context/spring-context-3.0.xsd&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;context:component-scan base-package=&quot;com.gag.controller&quot; /&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;bean&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;class=&quot;org.springframework.web.servlet.view.InternalResourceViewResolver&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;property name=&quot;prefix&quot; value=&quot;/WEB-INF/jsp/&quot; /&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;property name=&quot;suffix&quot; value=&quot;.jsp&quot; /&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/bean&amp;gt;&lt;br /&gt;
&amp;lt;/beans&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
d) Create a package named as com.gag.controller (or any other name) and inside this package Create a new class named as&amp;nbsp;HelloWorldController and write following code:&lt;br /&gt;
&lt;br /&gt;
package com.gag.controller;&lt;br /&gt;
&lt;br /&gt;
import org.springframework.stereotype.Controller;&lt;br /&gt;
import org.springframework.web.bind.annotation.RequestMapping;&lt;br /&gt;
import org.springframework.web.servlet.ModelAndView;&lt;br /&gt;
&lt;br /&gt;
@Controller&lt;br /&gt;
public class HelloWorldController {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;@RequestMapping(&quot;/hello&quot;)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public ModelAndView helloWorld() {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;String message = &quot;HELLO SPRING MVC HOW R U&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(&quot;Here.............&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return new ModelAndView(&quot;hellopage&quot;, &quot;message&quot;, message);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
e) Create a folder inside WEB-INF named as jsp and inside this folder Create a new JSP named as hellopage.jsp and write following code in it:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;%@ page language=&quot;java&quot; contentType=&quot;text/html; charset=ISO-8859-1&quot;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;pageEncoding=&quot;ISO-8859-1&quot;%&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;%@page isELIgnored=&quot;false&quot; %&amp;gt;&lt;br /&gt;
&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
&amp;lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=ISO-8859-1&quot;&amp;gt;&lt;br /&gt;
&amp;lt;title&amp;gt;Insert title here&amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;${message}&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://techs4.blogspot.com/feeds/6825884747007002310/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techs4.blogspot.com/2016/06/spring-mvc-hello-world.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/6825884747007002310'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/6825884747007002310'/><link rel='alternate' type='text/html' href='http://techs4.blogspot.com/2016/06/spring-mvc-hello-world.html' title='Spring MVC Hello World'/><author><name>Gagandeep Singh</name><uri>http://www.blogger.com/profile/01502339043741247951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9030977462820689825.post-7408002924248477278</id><published>2013-04-23T04:39:00.000-04:00</published><updated>2013-04-23T04:39:28.745-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="CGI"/><category scheme="http://www.blogger.com/atom/ns#" term="client"/><category scheme="http://www.blogger.com/atom/ns#" term="HTTP"/><category scheme="http://www.blogger.com/atom/ns#" term="Interface"/><category scheme="http://www.blogger.com/atom/ns#" term="Java Servlet"/><category scheme="http://www.blogger.com/atom/ns#" term="javax"/><category scheme="http://www.blogger.com/atom/ns#" term="servlet"/><category scheme="http://www.blogger.com/atom/ns#" term="servlet lifecycle"/><category scheme="http://www.blogger.com/atom/ns#" term="ServletRequest"/><title type='text'>Servlet Question Answers</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Georgia;&quot;&gt;
&lt;span style=&quot;color: #cc0000; font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Certain Servlets interview Q/As&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Georgia;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Georgia, serif; line-height: 18px; text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Georgia;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Georgia, serif; line-height: 18px; text-align: -webkit-auto;&quot;&gt;Q1. What is a servlet ?&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Georgia;&quot;&gt;
&lt;span style=&quot;color: #bf9000; font-family: Times, &#39;Times New Roman&#39;, serif; line-height: 18px; text-align: -webkit-auto;&quot;&gt;Servlets are modules that extend request/response-oriented servers,such as Java-enabled web servers. For example, a servlet might be responsible for taking data in an HTML order-entry form and applying the business logic used to update a company’s order database. Servlets are to servers what applets are to browsers. Unlike applets, however, servlets have no graphical user interface.&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;line-height: 18px; text-align: -webkit-auto;&quot;&gt;&lt;span style=&quot;color: #b45f06; font-family: Times, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #6aa84f;&quot;&gt;&lt;span style=&quot;border: 0px; font-family: Georgia, serif; line-height: 18px; margin: 0px; outline: 0px; padding: 0px; text-align: -webkit-auto; vertical-align: baseline;&quot;&gt;Q2.&amp;nbsp;Whats the advantages using&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; font-family: Georgia, serif; line-height: 18px; margin: 0px; outline: 0px; padding: 0px; text-align: -webkit-auto; vertical-align: baseline;&quot;&gt;servlets over using CGI?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;line-height: 18px; text-align: -webkit-auto;&quot;&gt;&lt;span style=&quot;color: #bf9000; font-family: Times, Times New Roman, serif;&quot;&gt;Servlets provide a way to generate dynamic documents that is both easier to write and faster to run. Servlets also address the problem of doing server-side programming with platform-specific APIs: they are developed with the Java Servlet API, a standard Java extension.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;line-height: 18px; text-align: -webkit-auto;&quot;&gt;&lt;span style=&quot;color: #bf9000; font-family: Times, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Times, &#39;Times New Roman&#39;, serif; line-height: 18px; text-align: -webkit-auto;&quot;&gt;Q3. What are the general advantages and selling points of Servlets?&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-family: Times, &#39;Times New Roman&#39;, serif; line-height: 18px; text-align: -webkit-auto;&quot;&gt;A servlet can handle multiple requests concurrently, and synchronize requests. This allows servlets to support systems such as online&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #bf9000; font-family: Times, &#39;Times New Roman&#39;, serif; line-height: 18px; text-align: -webkit-auto;&quot;&gt;real-time conferencing. Servlets can forward requests to other servers and servlets. Thus servlets can be used to balance load among several servers that mirror the same content, and to partition a single logical service over several servers, according to task type or organizational boundaries.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-family: Times, &#39;Times New Roman&#39;, serif; line-height: 18px; text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Times, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;border: 0px; line-height: 18px; margin: 0px; outline: 0px; padding: 0px; text-align: -webkit-auto; vertical-align: baseline;&quot;&gt;Q4. Which package provides interfaces and classes for writing servlets?&lt;/span&gt;&lt;span style=&quot;line-height: 18px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, serif; line-height: 18px; text-align: -webkit-auto;&quot;&gt;&lt;span style=&quot;color: #bf9000;&quot;&gt;javax&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, serif; line-height: 18px; text-align: -webkit-auto;&quot;&gt;&lt;span style=&quot;color: #bf9000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;border: 0px; line-height: 18px; margin: 0px; outline: 0px; padding: 0px; text-align: -webkit-auto; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;color: #6aa84f; font-family: Times, Times New Roman, serif;&quot;&gt;Q5. What’s the Servlet Interface?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-family: Times, &#39;Times New Roman&#39;, serif; line-height: 18px; text-align: -webkit-auto;&quot;&gt;The central abstraction in the Servlet API is the Servlet interface. All servlets implement this interface, either directly or, more&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #bf9000; font-family: Times, &#39;Times New Roman&#39;, serif; line-height: 18px; text-align: -webkit-auto;&quot;&gt;commonly, by extending a class that implements it such as HttpServlet.Servlets &amp;gt; Generic Servlet &amp;gt; HttpServlet &amp;gt; MyServlet.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #bf9000; font-family: Times, &#39;Times New Roman&#39;, serif; line-height: 18px; text-align: -webkit-auto;&quot;&gt;The Servlet interface declares, but does not implement, methods that manage the servlet and its communications with clients. Servlet writers provide some or all of these methods when developing a servlet.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-family: Times, &#39;Times New Roman&#39;, serif; line-height: 18px; text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;border: 0px; line-height: 18px; margin: 0px; outline: 0px; padding: 0px; text-align: -webkit-auto; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;color: #6aa84f; font-family: Times, Times New Roman, serif;&quot;&gt;Q6. When a servlet accepts a call from a client, it receives two objects. What are they?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;line-height: 18px; text-align: -webkit-auto;&quot;&gt;&lt;span style=&quot;color: #bf9000; font-family: Times, Times New Roman, serif;&quot;&gt;ServletRequest (which encapsulates the communication from the client to the server) and ServletResponse (which encapsulates the communication from the servlet back to the client). ServletRequest and ServletResponse are interfaces defined inside javax.servlet package.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, serif; font-size: 12px; line-height: 18px; text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;border: 0px; line-height: 18px; margin: 0px; outline: 0px; padding: 0px; text-align: -webkit-auto; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;color: #6aa84f; font-family: Times, Times New Roman, serif;&quot;&gt;Q7. What information does ServletRequest allow access to?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-family: Times, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;line-height: 18px; text-align: -webkit-auto;&quot;&gt;Information such as the names of the parameters passed in by the client, the protocol (scheme) being used by the client, and the names&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;line-height: 18px; text-align: -webkit-auto;&quot;&gt;of the remote host that made the request and the server that received it. Also the input stream, as ServletInputStream.Servlets use the input stream to get data from clients that use application protocols such as the HTTP POST and GET methods.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, serif; font-size: 12px; line-height: 18px; text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;border: 0px; line-height: 18px; margin: 0px; outline: 0px; padding: 0px; text-align: -webkit-auto; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;color: #6aa84f; font-family: Times, Times New Roman, serif;&quot;&gt;Q8. What type of constraints can ServletResponse interface set on the client?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #bf9000; font-family: Times, Times New Roman, serif;&quot;&gt;&lt;span style=&quot;line-height: 18px; text-align: -webkit-auto;&quot;&gt;It can set the content length and MIME type of the reply. It also provides an output stream, ServletOutputStream and a Writer through&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;line-height: 18px; text-align: -webkit-auto;&quot;&gt;which the servlet can send the reply data.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, serif; font-size: 12px; line-height: 18px; text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;border: 0px; line-height: 18px; margin: 0px; outline: 0px; padding: 0px; text-align: -webkit-auto; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;color: #6aa84f; font-family: Times, Times New Roman, serif;&quot;&gt;Q9. Explain servlet lifecycle?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;line-height: 18px; text-align: -webkit-auto;&quot;&gt;&lt;span style=&quot;color: #bf9000; font-family: Times, Times New Roman, serif;&quot;&gt;Each servlet has the same life cycle: first, the server loads and initializes the servlet (init()), then the servlet handles zero or more client requests (service()), after that the server removes the servlet (destroy()). Worth noting that the last step on some servers is done when they shut down.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Georgia, serif; font-size: 12px; line-height: 18px; text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;border: 0px; line-height: 18px; margin: 0px; outline: 0px; padding: 0px; text-align: -webkit-auto; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;color: #6aa84f; font-family: Times, Times New Roman, serif;&quot;&gt;Q10. How does HTTP Servlet handle client requests?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;line-height: 18px; text-align: -webkit-auto;&quot;&gt;&lt;span style=&quot;color: #bf9000; font-family: Times, Times New Roman, serif;&quot;&gt;An HTTP Servlet handles client requests through its service method. The service method supports standard HTTP client requests by dispatching each request to a method designed to handle that request.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://techs4.blogspot.com/feeds/7408002924248477278/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techs4.blogspot.com/2013/04/servlet-question-answers.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/7408002924248477278'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/7408002924248477278'/><link rel='alternate' type='text/html' href='http://techs4.blogspot.com/2013/04/servlet-question-answers.html' title='Servlet Question Answers'/><author><name>Gagandeep Singh</name><uri>http://www.blogger.com/profile/01502339043741247951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9030977462820689825.post-981779849568513645</id><published>2013-04-22T20:40:00.002-04:00</published><updated>2013-04-22T20:40:42.875-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="constructor"/><category scheme="http://www.blogger.com/atom/ns#" term="HTML"/><category scheme="http://www.blogger.com/atom/ns#" term="implicit objects"/><category scheme="http://www.blogger.com/atom/ns#" term="init()"/><category scheme="http://www.blogger.com/atom/ns#" term="JSP"/><category scheme="http://www.blogger.com/atom/ns#" term="JSP page"/><category scheme="http://www.blogger.com/atom/ns#" term="security"/><title type='text'>JSP Interview Questions</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;h1 style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;interview-heading&quot; style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: 15pt; font-weight: bolder;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;Certain JSP interview question answers...&lt;/span&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;interview-heading&quot; style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: 15pt; font-weight: bolder;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; text-align: justify;&quot;&gt;
&lt;span class=&quot;for_questions_blue&quot; style=&quot;font-family: VErdana;&quot;&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;Q1. What is a JSP and what is it used for?&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: VErdana;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #bf9000;&quot;&gt;Java Server Pages (JSP) is a platform independent presentation layer technology that comes with SUN s J2EE platform. JSPs are normal HTML pages with Java code pieces embedded in them. JSP pages are saved to *.jsp files. A JSP compiler is used in the background to generate a Servlet from the JSP page.&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; text-align: justify;&quot;&gt;
&lt;span class=&quot;for_questions_blue&quot; style=&quot;font-family: VErdana;&quot;&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;Q2. What is difference between custom JSP tags and beans?&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: VErdana;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #bf9000;&quot;&gt;Custom JSP tag is a tag you defined. You define how a tag, its attributes and its body are interpreted, and then group your tags into collections called tag libraries that can be used in any number of JSP files&lt;/span&gt;.&lt;/div&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;To use custom JSP tags, you need to define three separate components:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #bf9000; font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;1. the tag handler class that defines the tag\&#39;s behavior&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: #bf9000;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;2. the tag library descriptor file that maps the XML element names to the tag implementations&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
3. the JSP file that uses the tag library&amp;nbsp;&lt;/div&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #bf9000; font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #cc0000;&quot;&gt;When the first two components are done, you can use the tag by using taglib directive:&lt;/span&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #cc0000; font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: #bf9000; font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;lt;%@ taglib uri=&quot;xxx.tld&quot; prefix=&quot;...&quot; %&amp;gt;&lt;/div&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #bf9000; font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: #bf9000; font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
Then you are ready to use the tags you defined.&lt;/div&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #cc0000; font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;Let&#39;s say the tag prefix is test:&lt;/span&gt;&lt;span style=&quot;color: #cc0000; font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: #bf9000; font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
MyJSPTag or&amp;nbsp;JavaBeans are Java utility classes you defined. Beans have a standard format for Java classes. You use tags to declare a bean and use to set value of the bean class and use to get value of the bean class.&amp;nbsp;&lt;/div&gt;
&lt;/span&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;&amp;lt;%=identifier.getclassField() %&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
Custom tags and beans accomplish the same goals, encapsulating complex behavior into simple and accessible forms.&lt;/div&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #cc0000; font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;There are several differences:&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: #b45f06;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;a) Custom tags can manipulate JSP content; beans cannot.&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
b) Complex operations can be reduced to a significantly simpler form with custom tags than with beans. c) Custom tags require quite a bit more work to set up than do beans.&amp;nbsp;&lt;/div&gt;
&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
d) Custom tags usually define relatively self-contained behavior, whereas beans are often defined in &amp;nbsp; one servlet and used in a different servlet or JSP page.&lt;/div&gt;
&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
e) Custom tags are available only in JSP 1.1 and later, but beans can be used in all JSP 1.x versions.&lt;/div&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; text-align: justify;&quot;&gt;
&lt;span class=&quot;for_questions_blue&quot; style=&quot;font-family: VErdana;&quot;&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;Q3. What are the two kinds of comments in JSP and what&#39;s the difference between them ?&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: VErdana;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: #bf9000;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;1.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;JSP Comment&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: #bf9000;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;Example:&lt;/span&gt;&lt;span style=&quot;color: #bf9000;&quot;&gt; &amp;nbsp; &amp;nbsp; &amp;lt;%-- JSP Comment --%&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #bf9000;&quot;&gt;&lt;span style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;2.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;HTML Comment&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;&lt;span style=&quot;color: #bf9000;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;Example: &lt;/span&gt;&lt;span style=&quot;color: #bf9000;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;lt;!-- HTML Comment --&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; text-align: justify;&quot;&gt;
&lt;span class=&quot;for_questions_blue&quot; style=&quot;font-family: VErdana;&quot;&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;Q4. What is JSP technology?&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; text-align: justify;&quot;&gt;
&lt;span class=&quot;for_questions_blue&quot; style=&quot;font-family: VErdana;&quot;&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #b45f06;&quot;&gt;Java Server Page is a standard Java extension that is defined on top of the servlet Extensions. The goal of JSP is the simplified creation and management of dynamic Web pages. JSPs are secure, platform-independent, and best of all, make use of Java as a server-side scripting language.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; text-align: justify;&quot;&gt;
&lt;span class=&quot;for_questions_blue&quot; style=&quot;font-family: VErdana;&quot;&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;Q5. How can a servlet refresh automatically if some new data has entered the database?&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: VErdana; font-size: x-small; font-weight: bold;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: #b45f06; font-family: Bookman Old Style, Arial, Times New Roman;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 14px;&quot;&gt;You can use a client-side Refresh or Server Push.&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Bookman Old Style, Arial, Times New Roman;&quot;&gt;&lt;span style=&quot;font-size: 14px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: VErdana;&quot;&gt;Q6. How many JSP scripting elements and what are they?&lt;/span&gt;&lt;span style=&quot;color: #6aa84f; font-family: VErdana;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: VErdana; font-size: x-small; font-weight: bold;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: #cc0000; font-family: Bookman Old Style, Arial, Times New Roman;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 14px;&quot;&gt;There are three scripting language elements:&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;span style=&quot;color: #b45f06; font-family: Bookman Old Style, Arial, Times New Roman;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 14px;&quot;&gt;1. declarations&lt;/span&gt;&lt;span style=&quot;font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;span style=&quot;color: #b45f06; font-family: Bookman Old Style, Arial, Times New Roman;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 14px;&quot;&gt;2. scriptlets&lt;/span&gt;&lt;span style=&quot;font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;span style=&quot;color: #b45f06; font-family: Bookman Old Style, Arial, Times New Roman;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 14px;&quot;&gt;3. expressions&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Bookman Old Style, Arial, Times New Roman;&quot;&gt;&lt;span style=&quot;font-size: 14px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; text-align: justify;&quot;&gt;
&lt;span class=&quot;for_questions_blue&quot; style=&quot;font-family: VErdana;&quot;&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;Q7. Why are JSP pages the preferred API for creating a web-based client program?&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: VErdana; font-size: x-small; font-weight: bold;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: #b45f06; font-family: Bookman Old Style, Arial, Times New Roman;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 14px;&quot;&gt;Because no plug-ins or security policy files are needed on the client systems(applet does). Also, JSP pages enable cleaner and more module application design because they provide a way to separate applications programming from web page design. This means personnel involved in web page design do not need to understand Java programming language syntax to do their jobs.&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Bookman Old Style, Arial, Times New Roman;&quot;&gt;&lt;span style=&quot;font-size: 14px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; text-align: justify;&quot;&gt;
&lt;span class=&quot;for_questions_blue&quot; style=&quot;font-family: VErdana;&quot;&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;Q8. Is JSP technology extensible?&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: VErdana; font-size: x-small; font-weight: bold;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: #b45f06; font-family: Bookman Old Style, Arial, Times New Roman;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 14px;&quot;&gt;YES. JSP technology is extensible through the development of custom actions, or tags, which are encapsulated in tag libraries.&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #b45f06; font-family: Bookman Old Style, Arial, Times New Roman;&quot;&gt;&lt;span style=&quot;font-size: 14px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; text-align: justify;&quot;&gt;
&lt;span class=&quot;for_questions_blue&quot; style=&quot;font-family: VErdana;&quot;&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;Q9. What are the implicit objects?&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: VErdana; font-size: x-small; font-weight: bold;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Bookman Old Style, Arial, Times New Roman;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #b45f06; font-size: 14px;&quot;&gt;Implicit objects are objects that are created by the web container and contain information related to a particular request, page, or application.&lt;/span&gt;&lt;span style=&quot;color: #cc0000; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;answers&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #cc0000; font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;They are:&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: #b45f06; font-family: Bookman Old Style, Arial, Times New Roman;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 14px;&quot;&gt;1. request&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;span style=&quot;color: #b45f06; font-family: Bookman Old Style, Arial, Times New Roman;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 14px;&quot;&gt;2. response&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;answers&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #b45f06; font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;3. exception&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: #b45f06; font-family: Bookman Old Style, Arial, Times New Roman;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 14px;&quot;&gt;4. pageContext&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;answers&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #b45f06; font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;5. out&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #b45f06; font-family: Bookman Old Style, Arial, Times New Roman;&quot;&gt;&lt;span style=&quot;font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: #b45f06; font-family: Bookman Old Style, Arial, Times New Roman;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 14px;&quot;&gt;6. session&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;span style=&quot;color: #b45f06; font-family: Bookman Old Style, Arial, Times New Roman;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 14px;&quot;&gt;7. application&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;answers&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #b45f06; font-family: Bookman Old Style, Arial, Times New Roman;&quot;&gt;&lt;span style=&quot;font-size: 14px;&quot;&gt;8.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #b45f06; font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; font-size: 14px;&quot;&gt;config&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: #b45f06; font-family: Bookman Old Style, Arial, Times New Roman;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 14px;&quot;&gt;9. page&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Bookman Old Style, Arial, Times New Roman;&quot;&gt;&lt;span style=&quot;font-size: 14px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; text-align: justify;&quot;&gt;
&lt;span class=&quot;for_questions_blue&quot; style=&quot;font-family: VErdana;&quot;&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;Q10. Can we use the constructor, instead of init(), to initialize servlet?&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: VErdana; font-size: x-small; font-weight: bold;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: #b45f06; font-family: Bookman Old Style, Arial, Times New Roman;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 14px;&quot;&gt;Yes , of course you can use the constructor instead of init(). There’s nothing to stop you. But you shouldn’t. The original reason for init() was that ancient versions of Java couldn’t dynamically invoke constructors with arguments, so there was no way to give the constructur a ServletConfig. That no longer applies, but servlet containers still will only call your no-arg constructor. So you won’t have access to a ServletConfig or ServletContext.&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #b45f06; font-family: Bookman Old Style, Arial, Times New Roman;&quot;&gt;&lt;span style=&quot;font-size: 14px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; text-align: justify;&quot;&gt;
&lt;span class=&quot;for_questions_blue&quot; style=&quot;font-family: VErdana;&quot;&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;Q11. What is JSP page?&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: VErdana; font-size: x-small; font-weight: bold;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: #b45f06; font-family: Bookman Old Style, Arial, Times New Roman;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 14px;&quot;&gt;A JSP page is a text-based document that contains two types of text: static template data, which can be expressed in any text-based format such as HTML, SVG, WML, and XML, and JSP elements, which construct dynamic content.&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;answers&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Bookman Old Style, Arial, Times New Roman;&quot;&gt;&lt;span style=&quot;font-size: 14px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;answers&quot; style=&quot;font-family: &#39;Bookman Old Style&#39;, Arial, &#39;Times New Roman&#39;; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://techs4.blogspot.com/feeds/981779849568513645/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techs4.blogspot.com/2013/04/jsp-interview-questions.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/981779849568513645'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/981779849568513645'/><link rel='alternate' type='text/html' href='http://techs4.blogspot.com/2013/04/jsp-interview-questions.html' title='JSP Interview Questions'/><author><name>Gagandeep Singh</name><uri>http://www.blogger.com/profile/01502339043741247951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9030977462820689825.post-7018869250940604610</id><published>2013-01-20T22:42:00.001-05:00</published><updated>2013-01-20T22:42:49.263-05:00</updated><title type='text'>Java Today: Servlets</title><content type='html'>&lt;a href=&quot;http://techs4.blogspot.com/p/servlets.html?spref=bl&quot;&gt;Java Today: Servlets&lt;/a&gt;: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;  Basic Information about Servlets in Java:      1. Servlets are server side components that provide a powerful mechanism...</content><link rel='replies' type='application/atom+xml' href='http://techs4.blogspot.com/feeds/7018869250940604610/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techs4.blogspot.com/2013/01/java-today-servlets.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/7018869250940604610'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/7018869250940604610'/><link rel='alternate' type='text/html' href='http://techs4.blogspot.com/2013/01/java-today-servlets.html' title='Java Today: Servlets'/><author><name>Gagandeep Singh</name><uri>http://www.blogger.com/profile/01502339043741247951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9030977462820689825.post-5360362239557833571</id><published>2013-01-20T09:55:00.001-05:00</published><updated>2013-01-21T07:02:29.034-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="servlets"/><title type='text'>Interview Questions - Servlets and latest version</title><content type='html'>&lt;html&gt;&lt;br /&gt;
&lt;head&gt;&lt;br /&gt;
&lt;script type=&quot;text/javascript&quot;&gt;

  var _gaq = _gaq || [];
  _gaq.push([&#39;_setAccount&#39;, &#39;UA-30661081-2&#39;]);
  _gaq.push([&#39;_setDomainName&#39;, &#39;blogspot.in&#39;]);
  _gaq.push([&#39;_setAllowLinker&#39;, true]);
  _gaq.push([&#39;_trackPageview&#39;]);

  (function() {
    var ga = document.createElement(&#39;script&#39;); ga.type = &#39;text/javascript&#39;; ga.async = true;
    ga.src = (&#39;https:&#39; == document.location.protocol ? &#39;https://&#39; : &#39;http://&#39;) + &#39;stats.g.doubleclick.net/dc.js&#39;;
    var s = document.getElementsByTagName(&#39;script&#39;)[0]; s.parentNode.insertBefore(ga, s);
  })();

&lt;/script&gt;&lt;br /&gt;
&lt;/head&gt;&lt;br /&gt;
&lt;body&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Hi Friends...!!..&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Check out the new version of Java7.&amp;nbsp;You may click the link below&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;a href=&quot;http://www.java.com/en/download/index.jsp&quot; target=&quot;_blank&quot;&gt;http://www.java.com/en/download/index.jsp &lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;span style=&quot;color: red; font-family: Courier New, Courier, monospace; font-size: large;&quot;&gt;&lt;b&gt;Some brief information about Java:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Geneva; font-size: 18px; margin-bottom: 6px;&quot;&gt;1. Java is a general-purpose, concurrent, class-based, object-oriented computer programming language that is specifically designed to have as few implementation dependencies as possible. It is intended to let application developers &quot;write once, run anywhere&quot; meaning that code that runs on one platform does not need to be recompiled to run on another.&lt;/div&gt;&lt;div style=&quot;font-family: Geneva; font-size: 18px; margin-bottom: 6px; min-height: 25px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Geneva; font-size: 18px; margin-bottom: 6px;&quot;&gt;2.&amp;nbsp; Java applications are typically compiled to bytecode (class file) that can run on any JVM regardless of computer architecture. Java is, as of 2012, one of the most popular programming languages in use, particularly for client-server web applications, with a reported 15 million users. Java was originally developed by James Gosling at Sun Microsystems (which has since merged into Oracle Corporation) and released in 1995 as a core component of Sun Microsystems&#39; Java platform. The language derives much of its syntax from C++, but it has fewer low-level facilities than either of them.&lt;/div&gt;&lt;div style=&quot;font-family: Geneva; font-size: 18px; margin-bottom: 6px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Geneva; margin-bottom: 6px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #351c75; font-size: large;&quot;&gt;Some questions about Servlets:&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Geneva; margin-bottom: 6px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #351c75; font-size: large;&quot;&gt;Technical Interviewers ask mostly from this topic just to check your basic skills.&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Geneva; font-size: 18px; margin-bottom: 6px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Geneva; font-size: 18px; margin-bottom: 6px;&quot;&gt;&lt;table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt; &lt;td style=&quot;margin: 0.5px 0.5px 0.5px 0.5px; padding: 4.0px 4.0px 4.0px 4.0px; width: 897.0px;&quot; valign=&quot;middle&quot;&gt;&lt;table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;width: 897.0px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt; &lt;td style=&quot;width: 27.0px;&quot; valign=&quot;top&quot;&gt;&lt;div style=&quot;color: #b40f00; font-family: Monaco;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Q:&lt;/span&gt;&lt;/div&gt;&lt;/td&gt; &lt;td colspan=&quot;2&quot; style=&quot;width: 870.0px;&quot; valign=&quot;top&quot;&gt;&lt;div style=&quot;color: #b40f00; font-family: Monaco; margin-bottom: 16px;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;What is the difference between HttpServlet and GenericServlet?&lt;/span&gt;&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td style=&quot;height: 22.0px; width: 27.0px;&quot; valign=&quot;top&quot;&gt;&lt;div style=&quot;font-family: Verdana;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;A:&lt;/span&gt;&lt;/div&gt;&lt;/td&gt; &lt;td colspan=&quot;2&quot; style=&quot;height: 22.0px; width: 870.0px;&quot; valign=&quot;top&quot;&gt;&lt;div style=&quot;font-family: Verdana;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;A GenericServlet has a service() method aimed to handle requests.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;HttpServlet extends GenericServlet and adds support for doGet(),&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;doPost(), doHead() methods (HTTP 1.0) plus doPut(), doOptions(),&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;doDelete(), doTrace() methods (HTTP).&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Both these classes are abstract.&lt;/span&gt;&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td style=&quot;width: 27.0px;&quot; valign=&quot;top&quot;&gt;&lt;div style=&quot;font-family: Times;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;width: 314.0px;&quot; valign=&quot;top&quot;&gt;&lt;div style=&quot;font-family: Times; font-size: 16px; min-height: 19px;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;width: 556.0px;&quot; valign=&quot;top&quot;&gt;&lt;div style=&quot;font-family: Times; font-size: 16px; min-height: 19px; text-align: right;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;/tbody&gt; &lt;/table&gt;&lt;div style=&quot;font-family: Times; font-size: 16px; min-height: 19px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;width: 897.0px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt; &lt;td style=&quot;width: 27.0px;&quot; valign=&quot;top&quot;&gt;&lt;div style=&quot;color: #b40f00; font-family: Monaco;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Q:&lt;/span&gt;&lt;/div&gt;&lt;/td&gt; &lt;td colspan=&quot;2&quot; style=&quot;width: 870.0px;&quot; valign=&quot;top&quot;&gt;&lt;div style=&quot;color: #b40f00; font-family: Monaco; margin-bottom: 16px;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;What is the difference between ServletContext and ServletConfig?&lt;/span&gt;&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td style=&quot;width: 27.0px;&quot; valign=&quot;top&quot;&gt;&lt;div style=&quot;font-family: Verdana;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;A:&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt; &lt;td colspan=&quot;2&quot; style=&quot;width: 870.0px;&quot; valign=&quot;top&quot;&gt;&lt;div style=&quot;font-family: Monaco;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;ServletContext:&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Defines a set of methods that a servlet uses to&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;communicate with its servlet container, for example, to get the&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;MIME type of a file, dispatch requests, or write to a log file.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;The ServletContext object is contained within the ServletConfig object,&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;which the Web server provides the servlet when the servlet is initialized&lt;span style=&quot;font-family: Times;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Times; min-height: 19px;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Monaco;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;ServletConfig:&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;The object created after a servlet is instantiated and&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;its default constructor is read. It is created to pass initialization information&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;to the servlet.&lt;/span&gt;&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;/tbody&gt; &lt;/table&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;/tbody&gt; &lt;/table&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Geneva; font-size: 18px; margin-bottom: 6px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;/body&gt;&lt;br /&gt;
&lt;/html&gt;</content><link rel='replies' type='application/atom+xml' href='http://techs4.blogspot.com/feeds/5360362239557833571/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techs4.blogspot.com/2013/01/interview-questions-servlets-and-latest.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/5360362239557833571'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/5360362239557833571'/><link rel='alternate' type='text/html' href='http://techs4.blogspot.com/2013/01/interview-questions-servlets-and-latest.html' title='Interview Questions - Servlets and latest version'/><author><name>Gagandeep Singh</name><uri>http://www.blogger.com/profile/01502339043741247951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9030977462820689825.post-3268422117400133900</id><published>2012-07-16T13:11:00.000-04:00</published><updated>2012-07-26T15:54:49.176-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="exception"/><category scheme="http://www.blogger.com/atom/ns#" term="InterruptedException"/><category scheme="http://www.blogger.com/atom/ns#" term="sleep()"/><title type='text'>sleep() method in Java...</title><content type='html'>&lt;html&gt;&lt;head&gt;&lt;script type=&quot;text/javascript&quot;&gt;

  var _gaq = _gaq || [];
  _gaq.push([&#39;_setAccount&#39;, &#39;UA-30661081-1&#39;]);
  _gaq.push([&#39;_trackPageview&#39;]);

  (function() {
    var ga = document.createElement(&#39;script&#39;); ga.type = &#39;text/javascript&#39;; ga.async = true;
    ga.src = (&#39;https:&#39; == document.location.protocol ? &#39;https://ssl&#39; : &#39;http://www&#39;) + &#39;.google-analytics.com/ga.js&#39;;
    var s = document.getElementsByTagName(&#39;script&#39;)[0]; s.parentNode.insertBefore(ga, s);
  })();

&lt;/script&gt;&lt;/head&gt;&lt;body&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: red; font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;u&gt;sleep() method in Java...&lt;/u&gt;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;code&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;code&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;code&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;1. see which exception it throws&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;code&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;2. see how it works..&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;code&gt;&lt;br /&gt;
&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;code&gt;&lt;br /&gt;
&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;code&gt;Thread.sleep&lt;/code&gt;&amp;nbsp;causes the current thread to suspend execution for a specified period. This is an efficient means of making processor time available to the other threads of an application or other applications that might be running on a computer system. The&amp;nbsp;&lt;code&gt;sleep&lt;/code&gt;&amp;nbsp;method can also be used for pacing, as shown in the example that follows, and waiting for another thread with duties that are understood to have time requirements, as with the&amp;nbsp;&lt;code&gt;SimpleThreads&lt;/code&gt;&amp;nbsp;example in a later section.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Two overloaded versions of&amp;nbsp;&lt;code&gt;sleep&lt;/code&gt;&amp;nbsp;are provided: one that specifies the sleep time to the millisecond and one that specifies the sleep time to the nanosecond. However, these sleep times are not guaranteed to be precise, because they are limited by the facilities provided by the underlying OS. Also, the sleep period can be terminated by interrupts, as we&#39;ll see in a later section. In any case, you cannot assume that invoking&amp;nbsp;&lt;code&gt;sleep&lt;/code&gt;&amp;nbsp;will suspend the thread for precisely the time period specified.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;The&amp;nbsp;&lt;code&gt;&lt;b&gt;SleepMessages&lt;/b&gt;&lt;/code&gt;&amp;nbsp;example uses&amp;nbsp;&lt;code&gt;sleep&lt;/code&gt;&amp;nbsp;to print messages at four-second intervals:&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeblock&quot; style=&quot;margin: 0px 30px; text-align: -webkit-auto;&quot;&gt;&lt;pre&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;public class SleepMessages {
    public static void main(String args[])
        throws InterruptedException {
        String importantInfo[] = {
            &quot;Mares eat oats&quot;,
            &quot;Does eat oats&quot;,
            &quot;Little lambs eat ivy&quot;,
            &quot;A kid will eat ivy too&quot;
        };

        for (int i = 0;
             i &amp;lt; importantInfo.length;
             i++) {
            //Pause for 4 seconds
            Thread.sleep(4000);
            //Print a message
            System.out.println(importantInfo[i]);
        }
    }
}&lt;/span&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Notice that&amp;nbsp;&lt;code&gt;main&lt;/code&gt;&amp;nbsp;declares that it&amp;nbsp;&lt;code&gt;throws InterruptedException&lt;/code&gt;. This is an exception that&amp;nbsp;&lt;code&gt;sleep&lt;/code&gt;&amp;nbsp;throws when another thread interrupts the current thread while&amp;nbsp;&lt;code&gt;sleep&lt;/code&gt;&amp;nbsp;is active. Since this application has not defined another thread to cause the interrupt, it doesn&#39;t bother to catch&amp;nbsp;&lt;code&gt;InterruptedException&lt;/code&gt;.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/body&gt;&lt;br /&gt;
 &lt;/html&gt;</content><link rel='replies' type='application/atom+xml' href='http://techs4.blogspot.com/feeds/3268422117400133900/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techs4.blogspot.com/2012/07/sleep-method-in-java.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/3268422117400133900'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/3268422117400133900'/><link rel='alternate' type='text/html' href='http://techs4.blogspot.com/2012/07/sleep-method-in-java.html' title='sleep() method in Java...'/><author><name>Gagandeep Singh</name><uri>http://www.blogger.com/profile/01502339043741247951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9030977462820689825.post-7839171362919728767</id><published>2012-07-14T06:47:00.003-04:00</published><updated>2012-07-14T06:47:34.417-04:00</updated><title type='text'>Exceptions in java with an example</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div class=&quot;big&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif, &#39;Sans Serif&#39;; font-size: 12pt; font-weight: bold; text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;Overview&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;big&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif, &#39;Sans Serif&#39;; font-size: 12pt; font-weight: bold; text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;normal&quot; style=&quot;font-size: 13px; text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Java has a powerful concept for exception and error handling. An exception is an error that occurs at runtime. It is either generated by the Java Virtual Machine (VM) in response to an unexpected condition or it is generated by your code as a result of executing a&amp;nbsp;&lt;b&gt;throw&lt;/b&gt;&amp;nbsp;statement.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;normal&quot; style=&quot;font-size: 13px; text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;big&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif, &#39;Sans Serif&#39;; font-size: 12pt; font-weight: bold; text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;Understanding Exceptions&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;big&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif, &#39;Sans Serif&#39;; font-size: 12pt; font-weight: bold; text-align: -webkit-auto;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;normal&quot; style=&quot;font-size: 13px; text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Exceptions generated from runtime are called&amp;nbsp;&lt;i&gt;unchecked exceptions&lt;/i&gt;, since it is not possible for the compiler to determine that your code will handle the exception. Exception classes that descend from&amp;nbsp;&lt;i&gt;RuntimeException&lt;/i&gt;&amp;nbsp;and&amp;nbsp;&lt;i&gt;Error&lt;/i&gt;&amp;nbsp;classes are unchecked exceptions. Examples for&amp;nbsp;&lt;i&gt;RuntimeException&lt;/i&gt;&amp;nbsp;are illegal cast operation, inappropriate use of a null pointer, referencing an out of bounds array element.&amp;nbsp;&lt;i&gt;Error&lt;/i&gt;exception classes signal critical problems that typically cannot be handled by your application. Examples are out of memory error, stack overflow, failure of the Java VM.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;normal&quot; style=&quot;font-size: 13px; text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;normal&quot; style=&quot;font-size: 13px; text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Thrown exceptions are referred to as&amp;nbsp;&lt;i&gt;checked exceptions&lt;/i&gt;. The compiler will confirm at compile time that the method includes code that might&amp;nbsp;&lt;b&gt;throw&lt;/b&gt;&amp;nbsp;an exception. Moreover the compiler requires the code that calls such a method to include this call within a&lt;b&gt;try&lt;/b&gt;&amp;nbsp;block, and provide an appropriate&amp;nbsp;&lt;b&gt;catch&lt;/b&gt;&amp;nbsp;block to catch the exception.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;normal&quot; style=&quot;font-size: 13px; text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;courier&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier; font-size: 13px; text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;java.lang.Object&lt;br /&gt;&amp;nbsp;&amp;nbsp; |&lt;br /&gt;&amp;nbsp;&amp;nbsp; +--java.lang.Throwable&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +--java.lang.Exception&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +--java.lang.ClassNotFoundException&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +--java.io.IOException&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +--java.io.FileNotFoundException&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +--java.lang.RuntimeException&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +--java.lang.NullPointerException&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +--java.lang.IndexOutOfBoundsException&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +--java.lang.ArrayIndexOutOfBoundsException&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +--java.lang.Error&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +--java.lang.VirtualMachineError&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +--java.lang.OutOfMemoryError&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;courier&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier; font-size: 13px; text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;normal&quot; style=&quot;font-size: 13px; text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;When an (either checked or unchecked) exception is thrown, execution will attempt to immediately branch to the first&amp;nbsp;&lt;b&gt;catch&lt;/b&gt;&amp;nbsp;block whose associated exception class matches the class or a superclass of the thrown exception. If the exception does not occur within a&amp;nbsp;&lt;b&gt;try&lt;/b&gt;&amp;nbsp;block or the thrown exception is not caught in a matching&amp;nbsp;&lt;b&gt;catch&lt;/b&gt;block, execution of the method immediately terminates and control returns to the invoker of the method, where this process is repeated. The result is that the exception chain is escalated until a matching&amp;nbsp;&lt;b&gt;catch&lt;/b&gt;&amp;nbsp;block is found. If not, the thread containing the thrown exception is terminated.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;normal&quot; style=&quot;font-size: 13px; text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;header&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif, &#39;Sans Serif&#39;; font-size: 13px; font-weight: bold; text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;Example&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;header&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif, &#39;Sans Serif&#39;; font-size: 13px; font-weight: bold; text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;normal&quot; style=&quot;font-size: 13px; text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;The following Demo1 class demonstrates the behaviour of exceptions and applications.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;normal&quot; style=&quot;font-size: 13px; text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;courier&quot; style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;color: lime; font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;import java.io.*;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;courier&quot; style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;color: lime; font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;class Demo1 {&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;courier&quot; style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;color: lime; font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&amp;nbsp; public static FileInputStream f1(String fileName)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; throws FileNotFoundException&lt;br /&gt;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FileInputStream fis = new FileInputStream(fileName);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(&quot;f1: File input stream created&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return fis;&lt;br /&gt;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;courier&quot; style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;color: lime; font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&amp;nbsp; public static FileInputStream f2(String fileName)&lt;br /&gt;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FileInputStream fis = null;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; try&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fis = new FileInputStream(fileName);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (FileNotFoundException ex)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(&quot;f2: Oops, FileNotFoundException caught&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; finally&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(&quot;f2: finally block&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;System.out.println(&quot;f2: Returning from f2&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return fis;&lt;br /&gt;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;courier&quot; style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;color: lime; font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&amp;nbsp; public static void main(String args[])&lt;br /&gt;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FileInputStream fis1 = null;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FileInputStream fis2 = null;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; String fileName = &quot;foo.bar&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// String fileName = null;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;courier&quot; style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;color: lime; font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(&amp;nbsp; &quot;main: Starting &quot; + Demo1.class.getName()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; + &quot; with file name = &quot; + fileName);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;courier&quot; style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;color: lime; font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// get file input stream 1&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; try {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fis1 = f1(fileName);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (FileNotFoundException ex)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(&quot;main: Oops, FileNotFoundException caught&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (Exception ex)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(&quot;main: Oops, genreal exception caught&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;courier&quot; style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;color: lime; font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// get file input stream 2&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fis2 = f2(fileName);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;courier&quot; style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;color: lime; font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(&quot;main: &quot; + Demo1.class.getName() + &quot; ended&quot;);&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;courier&quot; style=&quot;text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;color: lime; font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;normal&quot; style=&quot;font-size: 13px; text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Compile and run the&amp;nbsp;&lt;i&gt;Demo1&lt;/i&gt;&amp;nbsp;class will generate output as follows (assuming that the file&amp;nbsp;&lt;i&gt;foo.bar&lt;/i&gt;&amp;nbsp;does not exist):&lt;/span&gt;&lt;/div&gt;
&lt;blockquote style=&quot;font-size: 13px; text-align: -webkit-auto;&quot;&gt;
&lt;div class=&quot;courier&quot; style=&quot;font-size: 10pt;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;main: Starting Demo1 with file name = foo.bar&lt;br /&gt;main: Oops, FileNotFoundException caught&lt;br /&gt;f2: Oops, FileNotFoundException caught&lt;br /&gt;f2: finally block&lt;br /&gt;f2: Returning from f2&lt;br /&gt;main: Demo1 ended&lt;/span&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div class=&quot;normal&quot; style=&quot;font-size: 13px; text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;The example program tries to create two file input streams. Therefore two methods&amp;nbsp;&lt;i&gt;f1&lt;/i&gt;and&amp;nbsp;&lt;i&gt;f2&lt;/i&gt;&amp;nbsp;are implemented. First, the main program calls&amp;nbsp;&lt;i&gt;f1&lt;/i&gt;&amp;nbsp;method. Because the constructor of the&amp;nbsp;&lt;i&gt;FileInputStream&lt;/i&gt;&amp;nbsp;throws a&amp;nbsp;&lt;i&gt;FileNotFoundException&lt;/i&gt;&amp;nbsp;the method&amp;nbsp;&lt;i&gt;f1&lt;/i&gt;must be defined with the&amp;nbsp;&lt;b&gt;throws&lt;/b&gt;&amp;nbsp;&lt;i&gt;FileNotFoundException&lt;/i&gt;&amp;nbsp;in the method definition. The thrown exception is not handled in the method but forwarded to the invoker. Note, that the system output before the&amp;nbsp;&lt;b&gt;return&lt;/b&gt;&amp;nbsp;statement is never executed.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;normal&quot; style=&quot;font-size: 13px; text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;normal&quot; style=&quot;font-size: 13px; text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;So the invoker, in our example the main program, must catch this exception. The method&amp;nbsp;&lt;i&gt;f1&lt;/i&gt;&amp;nbsp;is called in a&amp;nbsp;&lt;b&gt;try&lt;/b&gt;&amp;nbsp;block. The following&amp;nbsp;&lt;b&gt;catch&lt;/b&gt;&amp;nbsp;blocks catch either a&lt;i&gt;FileNotFoundException&lt;/i&gt;&amp;nbsp;or a general&amp;nbsp;&lt;i&gt;Exception&lt;/i&gt;. In our example, the exception is caught in the first&amp;nbsp;&lt;b&gt;catch&lt;/b&gt;&amp;nbsp;block and the system output is generated. Since the exception in&amp;nbsp;&lt;i&gt;f1&lt;/i&gt;&amp;nbsp;is caught and handled, the execution of the program is not terminated.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;normal&quot; style=&quot;font-size: 13px; text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;normal&quot; style=&quot;font-size: 13px; text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Second, the example program creates another&amp;nbsp;&lt;i&gt;FileInputStream&lt;/i&gt;&amp;nbsp;invoking the&amp;nbsp;&lt;i&gt;f2&lt;/i&gt;method. This method catches the&amp;nbsp;&lt;i&gt;FileNotFoundException&lt;/i&gt;, so this exception must not be forwarded to the invoker. The&amp;nbsp;&lt;b&gt;try ... catch&lt;/b&gt;&amp;nbsp;statement is followed by a&amp;nbsp;&lt;b&gt;finally&lt;/b&gt;block. This block is always executed, regardless whether or not an exception occurs within the&amp;nbsp;&lt;b&gt;try&lt;/b&gt;&amp;nbsp;block. This generates the system output in our example. Again, the exception is caught and the program executes, this generates the system output in&lt;i&gt;f2&lt;/i&gt;&amp;nbsp;and main.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;normal&quot; style=&quot;font-size: 13px; text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;normal&quot; style=&quot;font-size: 13px; text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;This was a straight forward example with caught exceptions. What happens with uncaught exceptions? Change the&amp;nbsp;&lt;i&gt;fileName&lt;/i&gt;&amp;nbsp;assignment in the main method: Comment out the first assignment and activate the second&amp;nbsp;&lt;i&gt;String fileName = null;&lt;/i&gt;&amp;nbsp;then compile and execute&amp;nbsp;&lt;i&gt;Demo1&lt;/i&gt;&amp;nbsp;again. The generated output is:&lt;/span&gt;&lt;/div&gt;
&lt;blockquote style=&quot;font-size: 13px; text-align: -webkit-auto;&quot;&gt;
&lt;div class=&quot;courier&quot; style=&quot;font-size: 10pt;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;main: Starting Demo1 with file name = null&lt;br /&gt;main: Oops, genreal exception caught&lt;br /&gt;&lt;i&gt;f2&lt;/i&gt;: finally block&lt;br /&gt;java.lang.NullPointerException&lt;br /&gt;java.io.FileInputStream Demo1.f2(java.lang.String)&lt;br /&gt;void Demo1.main(java.lang.String[])&lt;br /&gt;Exception in thread main&lt;/span&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div class=&quot;normal&quot; style=&quot;font-size: 13px; text-align: -webkit-auto;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;This time, we try to create two&amp;nbsp;&lt;i&gt;FileInputStream&lt;/i&gt;&amp;nbsp;objects using&amp;nbsp;&lt;b&gt;null&lt;/b&gt;&amp;nbsp;instead of a file name. Invoking&amp;nbsp;&lt;i&gt;f1&lt;/i&gt;&amp;nbsp;will generate a&amp;nbsp;&lt;i&gt;NullPointerException&lt;/i&gt;&amp;nbsp;which is caught in the main program. Next&amp;nbsp;&lt;i&gt;f2&lt;/i&gt;&amp;nbsp;is called which could handle only the&amp;nbsp;&lt;i&gt;FileNotFoundException&lt;/i&gt;&amp;nbsp;but not a&amp;nbsp;&lt;i&gt;NullPointerException&lt;/i&gt;. Nevertheless the&amp;nbsp;&lt;b&gt;finally&lt;/b&gt;&amp;nbsp;block is executed and then the control returns to the main program. Because there is no&amp;nbsp;&lt;b&gt;try ... catch&lt;/b&gt;&amp;nbsp;statement around the call to&amp;nbsp;&lt;i&gt;f2&lt;/i&gt;&amp;nbsp;and no matching&amp;nbsp;&lt;b&gt;catch&lt;/b&gt;&amp;nbsp;block is found, the thread is terminated. Note, that&amp;nbsp;&lt;i&gt;f2&lt;/i&gt;&amp;nbsp;and main can not execute the system output statements any more&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif, &#39;Sans Serif&#39;;&quot;&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techs4.blogspot.com/feeds/7839171362919728767/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techs4.blogspot.com/2012/07/exceptions-in-java-with-example.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/7839171362919728767'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/7839171362919728767'/><link rel='alternate' type='text/html' href='http://techs4.blogspot.com/2012/07/exceptions-in-java-with-example.html' title='Exceptions in java with an example'/><author><name>Gagandeep Singh</name><uri>http://www.blogger.com/profile/01502339043741247951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9030977462820689825.post-4315680609306094210</id><published>2012-04-19T08:28:00.000-04:00</published><updated>2012-04-19T08:28:21.269-04:00</updated><title type='text'>How to Track Changes in a Word 2007 Document For Dummies</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;h1 id=&quot;watch-headline-title&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; height: 1.1363em; line-height: 1.1363em; margin-bottom: 5px; margin-left: 0px; margin-right: 0px; margin-top: 0px; max-height: 1.1363em; overflow-x: hidden; overflow-y: hidden; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;

&lt;span class=&quot;long-title&quot; dir=&quot;ltr&quot; id=&quot;eow-title&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; letter-spacing: -0.5px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;How to Track Changes in a Word 2007 Document For Dummies&quot;&gt;&lt;span style=&quot;color: red; font-family: Arial, Helvetica, sans-serif; font-size: small;&quot;&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;u&gt;How to Track Changes in a Word 2007 Document For Dummies&lt;/u&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;div&gt;
&lt;span class=&quot;long-title&quot; dir=&quot;ltr&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; letter-spacing: -0.5px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;How to Track Changes in a Word 2007 Document For Dummies&quot;&gt;&lt;span style=&quot;color: red; font-family: Arial, Helvetica, sans-serif; font-size: small;&quot;&gt;&lt;i&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;266&#39; src=&#39;https://www.youtube.com/embed/jqzn4mtVoic?feature=player_embedded&#39; frameborder=&#39;0&#39;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;long-title&quot; dir=&quot;ltr&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; letter-spacing: -0.5px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;How to Track Changes in a Word 2007 Document For Dummies&quot;&gt;&lt;span style=&quot;color: red; font-family: Arial, Helvetica, sans-serif; font-size: small;&quot;&gt;&lt;i&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;long-title&quot; dir=&quot;ltr&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; letter-spacing: -0.5px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;How to Track Changes in a Word 2007 Document For Dummies&quot;&gt;&lt;span style=&quot;color: red; font-family: Arial, Helvetica, sans-serif; font-size: small;&quot;&gt;&lt;i&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;long-title&quot; dir=&quot;ltr&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; letter-spacing: -0.5px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;How to Track Changes in a Word 2007 Document For Dummies&quot;&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;Hey People..!!.. this feature will help you when you are preparing for requirements for your project in a team of 3 or 4 as it will track the changes made by the particular user.&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techs4.blogspot.com/feeds/4315680609306094210/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techs4.blogspot.com/2012/04/how-to-track-changes-in-word-2007.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/4315680609306094210'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/4315680609306094210'/><link rel='alternate' type='text/html' href='http://techs4.blogspot.com/2012/04/how-to-track-changes-in-word-2007.html' title='How to Track Changes in a Word 2007 Document For Dummies'/><author><name>Gagandeep Singh</name><uri>http://www.blogger.com/profile/01502339043741247951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9030977462820689825.post-2060618562968186315</id><published>2012-04-14T03:01:00.000-04:00</published><updated>2012-04-14T03:01:26.935-04:00</updated><title type='text'>Implementing an equals() Method</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: red; font-family: Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Overriding equals()&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;You learned about the equals() method in earlier chapters, where we looked at&amp;nbsp;the wrapper classes. We discussed how comparing two object references using the&amp;nbsp;== operator evaluates to true only when both references refer to the same object&amp;nbsp;(because == simply looks at the bits in the variable, and they&#39;re either identical or&amp;nbsp;they&#39;re not). You saw that the String class and the wrapper classes have overridden&amp;nbsp;the equals() method (inherited from class Object), so that you could compare&amp;nbsp;two different objects (of the same type) to see if their contents are meaningfully&amp;nbsp;equivalent. If two different Integer instances both hold the int value 5, as far as&amp;nbsp;you&#39;re concerned they are equal. The fact that the value 5 lives in two separate&amp;nbsp;objects doesn&#39;t matter.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;When you really need to know if two references are identical, use ==. But when&amp;nbsp;you need to know if the objects themselves (not the references) are equal, use the&amp;nbsp;equals() method. For each class you write, you must decide if it makes sense to&amp;nbsp;consider two different instances equal. For some classes, you might decide that&amp;nbsp;two objects can never be equal. For example, imagine a class Car that has instance&amp;nbsp;variables for things like make, model, year, configuration—you certainly don&#39;t want&amp;nbsp;your car suddenly to be treated as the very same car as someone with a car that has&amp;nbsp;identical attributes. Your car is your car and you don&#39;t want your neighbor Billy&amp;nbsp;driving off in it just because, &quot;hey, it&#39;s really the same car; the equals() method said&amp;nbsp;so.&quot; So no two cars should ever be considered exactly equal. If two references refer to&amp;nbsp;one car, then you know that both are talking about one car, not two cars that have&amp;nbsp;the same attributes. So in the case of a Car you might not ever need, or want, to&amp;nbsp;override the equals() method. Of course, you know that isn&#39;t the end of the story.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: lime; font-family: Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&lt;b&gt;Implementing an equals() Method&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;public class EqualsTest {&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;public static void main (String [] args) {&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;Moof one = new Moof(8);&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;Moof two = new Moof(8);&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;if (one.equals(two)) {&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;System.out.println(&quot;one and two are equal&quot;);&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;class Moof {&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;private int moofValue;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;Moof(int val) {&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;moofValue = val;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;public int getMoofValue() {&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;return moofValue;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;public boolean equals(Object o) {&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;if ((o instanceof Moof) &amp;amp;&amp;amp; (((Moof)o).getMoofValue()&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;== this.moofValue)) {&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;return true;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;} else {&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;return false;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techs4.blogspot.com/feeds/2060618562968186315/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techs4.blogspot.com/2012/04/implementing-equals-method.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/2060618562968186315'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/2060618562968186315'/><link rel='alternate' type='text/html' href='http://techs4.blogspot.com/2012/04/implementing-equals-method.html' title='Implementing an equals() Method'/><author><name>Gagandeep Singh</name><uri>http://www.blogger.com/profile/01502339043741247951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9030977462820689825.post-9180660788314556501</id><published>2012-04-10T11:04:00.001-04:00</published><updated>2012-04-11T09:22:25.769-04:00</updated><title type='text'>How to convert a date String to a Date or Calendar object?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: red; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;How to convert a date String to a Date or Calendar object?&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: red; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;lang-java prettyprint&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; vertical-align: baseline; width: auto;&quot;&gt;&lt;code style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;DateFormat&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt; formatter &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;SimpleDateFormat&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&quot;MM/dd/yy&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;Date&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt; date &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt; formatter&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;parse&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&quot;01/29/02&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; line-height: 18px; margin-bottom: 1em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;See&amp;nbsp;&lt;a href=&quot;http://java.sun.com/j2se/1.5.0/docs/api/java/text/SimpleDateFormat.html&quot; rel=&quot;nofollow&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; cursor: pointer; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;code style=&quot;background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1px; padding-left: 5px; padding-right: 5px; padding-top: 1px; vertical-align: baseline;&quot;&gt;SimpleDateFormat&lt;/code&gt;&amp;nbsp;javadoc&lt;/a&gt;&amp;nbsp;for more.&lt;/span&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;And to turn it into a&lt;/span&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1px; padding-left: 5px; padding-right: 5px; padding-top: 1px; vertical-align: baseline;&quot;&gt;Calendar&lt;/code&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;, do:&lt;/span&gt;&lt;/div&gt;
&lt;pre class=&quot;lang-java prettyprint&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; vertical-align: baseline; width: auto;&quot;&gt;&lt;code style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;Calendar&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt; calendar &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;Calendar&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;
calendar&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;setTime&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;lang-java prettyprint&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; vertical-align: baseline; width: auto;&quot;&gt;&lt;code style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;color: lime; font-family: Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;b&gt;Sample Program:&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;lang-java prettyprint&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; vertical-align: baseline; width: auto;&quot;&gt;&lt;code style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 24px; white-space: nowrap;&quot;&gt;import&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black; line-height: 24px; white-space: nowrap;&quot;&gt;java.util.*;&lt;/span&gt;
&lt;span style=&quot;line-height: 24px; white-space: nowrap;&quot;&gt;import&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black; line-height: 24px; white-space: nowrap;&quot;&gt;java.text.*;&lt;/span&gt;
&lt;span style=&quot;line-height: 24px; white-space: nowrap;&quot;&gt;public&amp;nbsp;class&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black; line-height: 24px; white-space: nowrap;&quot;&gt;DateToCalender&amp;nbsp;{&lt;/span&gt;
&lt;span style=&quot;line-height: 24px; white-space: nowrap;&quot;&gt;public&amp;nbsp;static&amp;nbsp;void&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black; line-height: 24px; white-space: nowrap;&quot;&gt;main(String[]&amp;nbsp;args)&amp;nbsp;{&lt;/span&gt;
&lt;span style=&quot;line-height: 24px; white-space: nowrap;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;line-height: 24px; white-space: nowrap;&quot;&gt;try&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black; line-height: 24px; white-space: nowrap;&quot;&gt;{&amp;nbsp;&amp;nbsp;String&amp;nbsp;str_date=&lt;/span&gt;&lt;span style=&quot;line-height: 24px; white-space: nowrap;&quot;&gt;&quot;11-June-07&quot;&lt;/span&gt;&lt;span style=&quot;color: black; line-height: 24px; white-space: nowrap;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;line-height: 24px; white-space: nowrap;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black; line-height: 24px; white-space: nowrap;&quot;&gt;DateFormat&amp;nbsp;formatter&amp;nbsp;;&amp;nbsp;&lt;/span&gt;
&lt;span style=&quot;line-height: 24px; white-space: nowrap;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black; line-height: 24px; white-space: nowrap;&quot;&gt;Date&amp;nbsp;date&amp;nbsp;;&amp;nbsp;&lt;/span&gt;
&lt;span style=&quot;line-height: 24px; white-space: nowrap;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black; line-height: 24px; white-space: nowrap;&quot;&gt;formatter&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;line-height: 24px; white-space: nowrap;&quot;&gt;new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black; line-height: 24px; white-space: nowrap;&quot;&gt;SimpleDateFormat(&lt;/span&gt;&lt;span style=&quot;line-height: 24px; white-space: nowrap;&quot;&gt;&quot;dd-MMM-yy&quot;&lt;/span&gt;&lt;span style=&quot;color: black; line-height: 24px; white-space: nowrap;&quot;&gt;);&lt;/span&gt;
&lt;span style=&quot;line-height: 24px; white-space: nowrap;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black; line-height: 24px; white-space: nowrap;&quot;&gt;date&amp;nbsp;=&amp;nbsp;(Date)formatter.parse(str_date);&amp;nbsp;&lt;/span&gt;
&lt;span style=&quot;line-height: 24px; white-space: nowrap;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black; line-height: 24px; white-space: nowrap;&quot;&gt;Calendar&amp;nbsp;cal=Calendar.getInstance();&lt;/span&gt;
&lt;span style=&quot;line-height: 24px; white-space: nowrap;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black; line-height: 24px; white-space: nowrap;&quot;&gt;cal.setTime(date);&lt;/span&gt;
&lt;span style=&quot;line-height: 24px; white-space: nowrap;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black; line-height: 24px; white-space: nowrap;&quot;&gt;System.out.println(&lt;/span&gt;&lt;span style=&quot;line-height: 24px; white-space: nowrap;&quot;&gt;&quot;Today&amp;nbsp;is&amp;nbsp;&quot;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black; line-height: 24px; white-space: nowrap;&quot;&gt;+cal&amp;nbsp;);&lt;/span&gt;
&lt;span style=&quot;line-height: 24px; white-space: nowrap;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black; line-height: 24px; white-space: nowrap;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;line-height: 24px; white-space: nowrap;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;line-height: 24px; white-space: nowrap;&quot;&gt;catch&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black; line-height: 24px; white-space: nowrap;&quot;&gt;(ParseException&amp;nbsp;e)&lt;/span&gt;
&lt;span style=&quot;line-height: 24px; white-space: nowrap;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black; line-height: 24px; white-space: nowrap;&quot;&gt;{System.out.println(&lt;/span&gt;&lt;span style=&quot;line-height: 24px; white-space: nowrap;&quot;&gt;&quot;Exception&amp;nbsp;:&quot;&lt;/span&gt;&lt;span style=&quot;color: black; line-height: 24px; white-space: nowrap;&quot;&gt;+e);&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&lt;/span&gt;
&lt;span style=&quot;line-height: 24px; white-space: nowrap;&quot;&gt;&amp;nbsp;&lt;/span&gt;
&lt;span style=&quot;line-height: 24px; white-space: nowrap;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black; line-height: 24px; white-space: nowrap;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: black; line-height: 24px; white-space: nowrap;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;line-height: 24px; white-space: nowrap;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;span style=&quot;color: red; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: red; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techs4.blogspot.com/feeds/9180660788314556501/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techs4.blogspot.com/2012/04/how-to-convert-date-string-to-date-or.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/9180660788314556501'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/9180660788314556501'/><link rel='alternate' type='text/html' href='http://techs4.blogspot.com/2012/04/how-to-convert-date-string-to-date-or.html' title='How to convert a date String to a Date or Calendar object?'/><author><name>Gagandeep Singh</name><uri>http://www.blogger.com/profile/01502339043741247951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9030977462820689825.post-5015113388099977827</id><published>2012-04-07T07:48:00.000-04:00</published><updated>2016-07-19T09:38:17.588-04:00</updated><title type='text'>OCJP Preparation Questions and Answers (***New Q/As Added***)</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;font-size: x-large;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: red;&quot;&gt;&lt;u&gt;OCJP Preparation&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; line-height: 20px; padding: 0px 0px 15px; text-align: justify;&quot;&gt;
&lt;strong&gt;What is the output for the below code ?&lt;/strong&gt;&lt;span style=&quot;color: #333333; font-size: 13px;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; line-height: 20px; padding: 0px 0px 15px; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;Question 1.&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;public class A {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int add(int i, int j) {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return i + j;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;public class B extends A {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static void main(String argv[]) {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;short s = 9;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(add(s, 6));&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; line-height: 15pt; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;Options are:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; line-height: 15pt; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;A. Compile fail due to error on line no 2&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; line-height: 15pt; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;B. Compile fail due to error on line no 9&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; line-height: 15pt; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;C. Compile fail due to error on line no 8&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; line-height: 15pt; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;D. 15&lt;/b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; line-height: 15pt; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; line-height: 15pt; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&lt;b&gt;Answer :&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #333333; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; line-height: 15pt; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;B is the correct answer.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; line-height: 15pt; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;Cannot make a static reference to the non-static method add(int, int) from the type A. The short s is autoboxed correctly, but the add() method cannot be invoked from a static method because add() method is not static.&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #990000; font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: xx-small;&quot;&gt;&lt;b&gt;Question 2.&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000; font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: xx-small;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;public class A {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int k;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;boolean istrue;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;static int p;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void printValue() {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.print(k);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.print(istrue);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.print(p);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;public class Test {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static void main(String argv[]) {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;A a = new A();&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;a.printValue();&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background-color: white; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 15pt; margin-bottom: 0in; text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;Options are:&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 15pt; margin-bottom: 0in; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;A.0 false 0&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 15pt; margin-bottom: 0in; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;B.0 true 0&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 15pt; margin-bottom: 0in; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;C.0 0 0&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 15pt; margin-bottom: 0in; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;D.Compile error – static variable must be initialized before use.&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 15pt; margin-bottom: 0in; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 15pt; margin-bottom: 0in; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #990000;&quot;&gt;Answer :&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #333333; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 15pt; margin-bottom: 0in; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;A is the correct answer.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 15pt; margin-bottom: 0in; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;Global and static variable need not be initialized before use. Default value of global and static int variable is zero. Default value of boolean variable is false. Remember local variable must be initialized before use.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; line-height: 20px; padding: 0px 0px 15px; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;color: #990000;&quot;&gt;Question 3.&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;public class Test {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int _$;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int $7;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int do;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static void main(String argv[]) {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Test test = new Test();&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;test.$7 = 7;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;test.do = 9;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(test.$7);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(test.do);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(test._$);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; line-height: 20px; padding: 0px 0px 15px; text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;strong&gt;&lt;span style=&quot;color: #990000; font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;Options are:&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;color: red; font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;A.7 9 0&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;B.7 0 0&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;C.Compile error – $7 is not valid identifier.&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;D.Compile error – do is not valid identifier.&lt;/b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #333333;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; line-height: 20px; padding: 0px 0px 15px; text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #990000; font-size: x-small;&quot;&gt;Answer:&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; line-height: 20px; padding: 0px 0px 15px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;D is the correct answer.&amp;nbsp;$7 is valid identifier. Identifiers must start with a letter, a currency character ($), or underscore ( _ ). Identifiers cannot start with a number. You can’t use a Java keyword as an identifier. do is a Java keyword.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; line-height: 20px; padding: 0px 0px 15px; text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;strong style=&quot;font-family: Arial, &#39;Century Gothic&#39;, Tahoma, Verdana;&quot;&gt;&lt;span style=&quot;color: #990000; font-size: xx-small;&quot;&gt;Question 4.&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;strong style=&quot;font-family: Arial, &#39;Century Gothic&#39;, Tahoma, Verdana;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;package com;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;class Animal {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void printName() {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(&quot;Animal&quot;);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;package exam;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;import com.Animal;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;public class Cat extends Animal {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void printName() {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(&quot;Cat&quot;);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;package exam;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;import com.Animal;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;public class Test {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static void main(String[] args) {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Animal a = new Cat();&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;a.printName();&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;Options are:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;A.Animal&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;B.Cat&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;C.Animal Cat&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;D.Compile Error&lt;/b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&lt;b&gt;Answer :&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #333333; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;D is the correct answer.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;Cat class won’t compile because its superclass, Animal, has default access and is in a different package. Only public superclass can be accessible for different package.&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h3 style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial;&quot;&gt;
&lt;strong style=&quot;font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana;&quot;&gt;&lt;span style=&quot;color: #990000; font-size: small;&quot;&gt;Question 5.&lt;/span&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;div style=&quot;margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;public class A {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int i = 10;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void printValue() {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(&quot;Value-A&quot;);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;public class B extends A {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;int i = 12;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void printValue() {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.print(&quot;Value-B&quot;);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;public class Test {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static void main(String argv[]) {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;A a = new B();&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;a.printValue();&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(a.i);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #990000;&quot;&gt;Options are:&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;A.Value-B 11&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;B.Value-B 10&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;C.Value-A 10&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;D.Value-A 11&lt;/b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&lt;b&gt;Answer:&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #333333; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;B is the correct answer.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;If you create object of subclass with reference of super class like ( A a = new B();) then subclass method and super class variable will be executed.&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h3 style=&quot;background-color: white; text-align: justify;&quot;&gt;
&lt;/h3&gt;
&lt;h3 style=&quot;background-color: white;&quot;&gt;
&lt;strong style=&quot;font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana;&quot;&gt;&lt;span style=&quot;color: #990000; font-size: small;&quot;&gt;Question 6.&lt;/span&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;div style=&quot;margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;public enum Test {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;BREAKFAST(7, 30), LUNCH(12, 15), DINNER(19, 45);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private int hh;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private int mm;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Test(int hh, int mm) {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;assert (hh &amp;gt;= 0 &amp;amp;&amp;amp; hh &amp;lt;= 23) : &quot;Illegal hour.&quot;;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;assert (mm &amp;gt;= 0 &amp;amp;&amp;amp; mm &amp;lt;= 59) : &quot;Illegal mins.&quot;;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;this.hh = hh;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;this.mm = mm;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public int getHour() {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return hh;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public int getMins() {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return mm;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static void main(String args[]){&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Test t = new BREAKFAST;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(t.getHour() +&quot;:&quot;+t.getMins());&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #990000;&quot;&gt;Options are:&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;A.7:30&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;B.Compile Error – an enum cannot be instantiated using the new operator.&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;C.12:30&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;D.19:45&lt;/b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #990000; font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #990000;&quot;&gt;Answer:&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #333333; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;B is the correct answer.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;As an enum cannot be instantiated using the new operator, the constructors cannot be called explicitly. You have to do like Test t = BREAKFAST;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;h3 style=&quot;background-color: white; text-align: justify;&quot;&gt;
&lt;/h3&gt;
&lt;h3 style=&quot;background-color: white;&quot;&gt;
&lt;strong style=&quot;font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana;&quot;&gt;&lt;span style=&quot;color: #990000; font-size: small;&quot;&gt;Question 7.&lt;/span&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;div style=&quot;margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;public class A {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;static {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(&quot;static:&quot;);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(&quot;block&quot;);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public A() {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(&quot;A&quot;);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static void main(String[] args) {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;A a = new A();&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&lt;b&gt;Options are:&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;A.A block static&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;B.static block A&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;C.static A&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;D.A&lt;/b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&lt;b&gt;Answer:&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #333333; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;B is the correct answer.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;First execute static block, then statement block then constructor.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong style=&quot;font-family: Arial, &#39;Century Gothic&#39;, Tahoma, Verdana; text-align: left;&quot;&gt;&lt;span style=&quot;color: #990000; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong style=&quot;font-family: Arial, &#39;Century Gothic&#39;, Tahoma, Verdana; text-align: left;&quot;&gt;&lt;span style=&quot;color: #990000; font-size: xx-small;&quot;&gt;Question 8.&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong style=&quot;font-family: Arial, &#39;Century Gothic&#39;, Tahoma, Verdana; text-align: left;&quot;&gt;&lt;span style=&quot;color: red; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;public class Test {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static void main(String[] args) {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;int i = 010;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;int j = 07;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(i);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(j);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;color: #990000; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #990000;&quot;&gt;Options are:&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;A.8 7&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;B.10 7&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;C.Compilation fails with an error at line 3&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;D.Compilation fails with an error at line 5&lt;/b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&lt;b&gt;Answer:&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #333333; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;A is the correct answer.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;By placing a zero in front of the number is an integer in octal form. 010 is in octal form .so its value is 8.&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h3 style=&quot;background-color: white; text-align: justify;&quot;&gt;
&lt;strong style=&quot;font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; text-align: left;&quot;&gt;&lt;span style=&quot;color: #990000; font-size: small;&quot;&gt;Question 9.&lt;/span&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;div style=&quot;margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;public class Test {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static void main(String[] args) {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;byte b = 6;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;b += 8;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(b);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;b = b + 7;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(b);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&lt;b&gt;Options are:&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;A.14 21&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;B.14 13&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;C.Compilation fails with an error at line 6&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;D.Compilation fails with an error at line 4&lt;/b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #990000; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #990000;&quot;&gt;Answer:&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #333333; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;C is the correct answer.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;int or smaller expressions always resulting in an int. So compiler complain about Type&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;mismatch: cannot convert from int to byte for b = b+7; But b += 7; // No problem&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;because +=, -=, *=, and /= will all put in an implicit cast. b += 7 is same as b = (byte)b+7&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;so compiler not complain.&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h3 style=&quot;background-color: white; text-align: justify;&quot;&gt;
&lt;/h3&gt;
&lt;h3 style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial;&quot;&gt;
&lt;strong style=&quot;font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana;&quot;&gt;&lt;span style=&quot;color: #990000; font-size: small;&quot;&gt;Question 10.&lt;/span&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;div style=&quot;margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;public class Test {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static void main(String[] args) {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;String value = &quot;abc&quot;;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;changeValue(value);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(value);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static void changeValue(String a) {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;a = &quot;xyz&quot;;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;&lt;strong&gt;&lt;span style=&quot;color: #990000; font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;Options are:&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;color: red; font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;A.abc&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;B.xyz&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;C.Compilation fails&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;D.Compilation clean but no output&lt;/b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #990000;&quot;&gt;Answer:&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #333333; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;A is the correct answer.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;Java pass reference as value. passing the object reference, and not the actual object itself.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;Simply reassigning to the parameter used to pass the value into the method will do&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;nothing, because the parameter is essentially a local variable.&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h3 style=&quot;background-color: white; text-align: justify;&quot;&gt;
&lt;/h3&gt;
&lt;h3 style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial;&quot;&gt;
&lt;strong style=&quot;font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana;&quot;&gt;&lt;span style=&quot;color: #990000; font-size: small;&quot;&gt;Question 11.&lt;/span&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;div style=&quot;margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;public class Test {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static void printValue(int i, int j, int k) {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(&quot;int&quot;);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static void printValue(byte... b) {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(&quot;long&quot;);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static void main(String... args) {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;byte b = 9;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;printValue(b, b, b);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;Options are:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;A.long&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;B.int&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;C.Compilation fails&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;D.Compilation clean but throws RuntimeException&lt;/b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;Answer:&lt;/span&gt;&lt;span style=&quot;color: red; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;B is the correct answer.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;Primitive widening uses the smallest method argument possible. (For Example if you pass short value to a method but method with short argument is not available then compiler choose method with int argument). But in this case compiler will prefer the older style before it chooses the newer style, to keep existing code more robust. var-args method is looser than widen.&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h3 style=&quot;background-color: white; text-align: justify;&quot;&gt;
&lt;/h3&gt;
&lt;h3 style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial;&quot;&gt;
&lt;strong style=&quot;font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana;&quot;&gt;&lt;span style=&quot;color: #990000; font-size: small;&quot;&gt;Question 12.&lt;/span&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;div style=&quot;font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;You have a java file name Test.java inside src folder of javaproject&amp;nbsp;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;directory. You have also classes&amp;nbsp;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;folder inside javaproject directory.&amp;nbsp;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;you have issued below command from command prompt.&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;cd javaproject&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;background-color: #fff2cc; color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;Which of the below command puts Test.class file inside classes folder ?&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: lime;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;Options are:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;A.javac -d classes src/Test.java&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;B.javac Test.java&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;C.javac src/Test.java&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;D.javac classes src/Test.java&lt;/b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&lt;b&gt;Answer:&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #333333; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;A is the correct answer.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;The -d option lets you tell the compiler in which directory to put the .class file it&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;generates (d for destination)&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h3 style=&quot;background-color: white; text-align: justify;&quot;&gt;
&lt;/h3&gt;
&lt;h3 style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial;&quot;&gt;
&lt;strong style=&quot;font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana;&quot;&gt;&lt;span style=&quot;color: #990000; font-size: small;&quot;&gt;Question 13.&lt;/span&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;You have two class files name Test.class and Test1.class inside javaproject directory.&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;Test.java source code is :&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;public class Test {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static void main(String[] args) {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(&quot;Hello Test&quot;);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white;&quot;&gt;
&lt;strong style=&quot;font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white;&quot;&gt;
&lt;strong style=&quot;font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;Test1.java source code is :&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;public class Test1 {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static void main(String[] args) {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(&quot;Hello Test1&quot;);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;you have issued below commands from command prompt.&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;cd javaproject&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;java Test Test1&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;What is the output ?&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;Options are:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;A.Hello Test&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;B.Hello Test Hello Test1&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;C.Hello Test1&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;D.Run fails – class not found&lt;/b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&lt;b&gt;Answer:&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #333333; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;A is the correct answer.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;You must specify exactly one class file to execute. If more than one then first one will be executed.&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h3 style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; text-align: justify;&quot;&gt;
&lt;strong style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: #990000; font-size: small;&quot;&gt;Question 14.&lt;/span&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;h3 style=&quot;font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;background-color: #fff2cc; font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;You have a java file name Test.java .&lt;/span&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;div style=&quot;font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;Test.java needs access to a class contained in app.jar in “exam”&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;background-color: #fff2cc; font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;directory.&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: lime;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;Which of the following command set classpath to compile clean?&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;Options are:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;A.javac -classpath exam/app.jar Test.java&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;B.javac -classpath app.jar Test.java&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;C.javac -classpath exam Test.java&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;D.None of the above&lt;/b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&lt;b&gt;Answer:&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #333333; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;A is the correct answer.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;javac -classpath exam/app.jar Test.java is the correct command to set exam/app.jar in classpath.&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h3 style=&quot;background-color: white; text-align: justify;&quot;&gt;
&lt;/h3&gt;
&lt;h3 style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana;&quot;&gt;
&lt;strong style=&quot;font-size: medium;&quot;&gt;&lt;span style=&quot;color: #990000; font-size: small;&quot;&gt;Question 15.&lt;/span&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;What will be the result of compiling the following code:&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: lime;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;public class SuperClass {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public int doIt(String str, Integer... data) throws Exception {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;String signature = &quot;(String, Integer[])&quot;;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(str + &quot; &quot; + signature);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return 1;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;public class SubClass extends SuperClass {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public int doIt(String str, Integer... data) {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;String signature = &quot;(String, Integer[])&quot;;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;System.out.println(&quot;Overridden: &quot; + str + &quot; &quot; + signature);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return 0;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static void main(String... args) {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;SuperClass sb = new SubClass();&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;sb.doIt(&quot;hello&quot;, 3);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;Options are:&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;arial&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;A.Overridden: hello (String, Integer[])&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;B.hello (String, Integer[])&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;C.Complilation fails&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;D.None of the above&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #990000;&quot;&gt;Answer:&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin: 0in 0in 0.0001pt; text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;C is the correct answer.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0in 0in 0.0001pt;&quot;&gt;
&lt;div style=&quot;background-color: white;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;Unhandled exception type Exception.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white;&quot;&gt;
&lt;span style=&quot;color: #990000; font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white;&quot;&gt;
&lt;span style=&quot;color: #990000; font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;b&gt;Question 16:&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white;&quot;&gt;
&lt;strong style=&quot;font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;What will be the result of following code:&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white;&quot;&gt;
&lt;strong style=&quot;font-family: arial, &amp;quot;century gothic&amp;quot;, tahoma, verdana; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;class MyException1 extends Exception {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public MyException1() {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;class MyException2 extends Exception {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public MyException2() {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;class ExceptionTest {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static void main(String[] args) throws Exception {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;m2();&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} finally {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;m3();&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} catch (MyException2 e) {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;background-color: #fff2cc; font-size: 13.3333px; white-space: pre;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;b&gt;  &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static void m2() throws MyException1 {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;throw new MyException1();&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static void m3() throws MyException2 {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;throw new MyException2();&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #fff2cc; font-size: 13.3333px;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white;&quot;&gt;
&lt;span style=&quot;color: #990000; font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white;&quot;&gt;
&lt;span style=&quot;color: #990000; font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;&lt;b&gt;Options:&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white;&quot;&gt;
&lt;span style=&quot;color: #990000; font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;&lt;b&gt;A. It will compile but will throw MyException1 when run.&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;&lt;b&gt;B. It will compile but will throw MyException2 when run.&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;&lt;b&gt;C. It will compile and run without throwing any exceptions.&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;&lt;b&gt;D. It will not compile.&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white;&quot;&gt;
&lt;span style=&quot;color: #990000; font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #990000;&quot;&gt;Answer:&lt;/span&gt;&lt;/b&gt; D&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white;&quot;&gt;
&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 10pt;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #990000;&quot;&gt;Explaination :&lt;/span&gt;&lt;/b&gt; catch block will come after try block&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://techs4.blogspot.com/feeds/5015113388099977827/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techs4.blogspot.com/2012/04/ocjp-16-preparation-questions-and.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/5015113388099977827'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/5015113388099977827'/><link rel='alternate' type='text/html' href='http://techs4.blogspot.com/2012/04/ocjp-16-preparation-questions-and.html' title='OCJP Preparation Questions and Answers (***New Q/As Added***)'/><author><name>Gagandeep Singh</name><uri>http://www.blogger.com/profile/01502339043741247951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9030977462820689825.post-7860775104648873128</id><published>2012-03-22T23:33:00.001-04:00</published><updated>2015-10-15T12:37:46.138-04:00</updated><title type='text'>Errors in Jasper Report</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;Errors in Jasper Reports:-&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:&lt;br /&gt;
1. Only a type can be imported. it.businesslogic.ireport.IReportScriptlet resolves to a package&lt;br /&gt;
import it.businesslogic.ireport.IReportScriptlet;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;---------------------------------------&amp;gt;&lt;br /&gt;
1 errors&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;Solution :- &lt;/span&gt;remove this line from the report(.jrxml) as shown below..This might come in ireport version 2.0.1 and when your ate using jasper jar 3.1.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYRuzNUXnCFkT5v1TKZ7FiNCcwjO4_XXOL4HcjT5uYU8SxpAxIsfcMHWP0pCvlE7CDVCD6qqnWsKCmkfKsWLmxCWdn5dN0ZhWx-Qm9mNaUyX3oTfcXRFFJYNz_ViTGwLUwsTKH9y7QIPm-/s1600/img.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;275&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYRuzNUXnCFkT5v1TKZ7FiNCcwjO4_XXOL4HcjT5uYU8SxpAxIsfcMHWP0pCvlE7CDVCD6qqnWsKCmkfKsWLmxCWdn5dN0ZhWx-Qm9mNaUyX3oTfcXRFFJYNz_ViTGwLUwsTKH9y7QIPm-/s640/img.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://techs4.blogspot.com/feeds/7860775104648873128/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techs4.blogspot.com/2012/03/errors-in-jasper-report.html#comment-form' title='17 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/7860775104648873128'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/7860775104648873128'/><link rel='alternate' type='text/html' href='http://techs4.blogspot.com/2012/03/errors-in-jasper-report.html' title='Errors in Jasper Report'/><author><name>Gagandeep Singh</name><uri>http://www.blogger.com/profile/01502339043741247951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYRuzNUXnCFkT5v1TKZ7FiNCcwjO4_XXOL4HcjT5uYU8SxpAxIsfcMHWP0pCvlE7CDVCD6qqnWsKCmkfKsWLmxCWdn5dN0ZhWx-Qm9mNaUyX3oTfcXRFFJYNz_ViTGwLUwsTKH9y7QIPm-/s72-c/img.jpg" height="72" width="72"/><thr:total>17</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9030977462820689825.post-5383336773581298283</id><published>2012-03-10T08:44:00.000-05:00</published><updated>2012-03-10T12:50:06.916-05:00</updated><title type='text'>Jasper Reports Video</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;266&#39; src=&#39;https://www.youtube.com/embed/6wzsajfCqGU?feature=player_embedded&#39; frameborder=&#39;0&#39;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #20124d; font-family: inherit; font-size: x-large;&quot;&gt;In Java&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: red; font-size: large;&quot;&gt;This is a small help for all those people who are adding jasper reports as a feature in their project. This basically helps us to generate reports in the form of .PDF and in the excel form also.&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techs4.blogspot.com/feeds/5383336773581298283/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techs4.blogspot.com/2012/03/jasper-reports-video.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/5383336773581298283'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/5383336773581298283'/><link rel='alternate' type='text/html' href='http://techs4.blogspot.com/2012/03/jasper-reports-video.html' title='Jasper Reports Video'/><author><name>Gagandeep Singh</name><uri>http://www.blogger.com/profile/01502339043741247951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9030977462820689825.post-4506026167029029631</id><published>2012-03-09T11:12:00.000-05:00</published><updated>2012-03-09T11:14:02.545-05:00</updated><title type='text'>Garbage Collection in Java</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: red; font-size: x-large;&quot;&gt;&lt;b&gt;Garbage Collection in Java&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: red; font-size: x-large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white; font-size: large;&quot;&gt;&lt;span style=&quot;color: magenta;&quot;&gt;&lt;b&gt;Overview of Memory Management and Garbage Collection&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;Memory management is a crucial element in many types of applications.&amp;nbsp;Consider a program that reads in large amounts of data, say from somewhere else&amp;nbsp;on a network, and then writes that data into a database on a hard drive. A typical&amp;nbsp;design would be to read the data into some sort of collection in memory, perform&amp;nbsp;some operations on the data, and then write the data into the database. After the&amp;nbsp;data is written into the database, the collection that stored the data temporarily&amp;nbsp;must be emptied of old data or deleted and recreated before processing the next&amp;nbsp;batch. This operation might be performed thousands of times, and in languages&amp;nbsp;like C or C++ that do not offer automatic garbage collection, a small flaw in the&amp;nbsp;logic that manually empties or deletes the collection data structures can allow small&amp;nbsp;amounts of memory to be improperly reclaimed or lost. Forever. These small losses&amp;nbsp;are called memory leaks, and over many thousands of iterations they can make&amp;nbsp;enough memory inaccessible that programs will eventually crash. Creating code&amp;nbsp;that performs manual memory management cleanly and thoroughly is a nontrivial&amp;nbsp;and complex task, and while estimates vary, it is arguable that manual memory&amp;nbsp;management can double the development effort for a complex program.&amp;nbsp;Java&#39;s garbage collector provides an automatic solution to memory management.&amp;nbsp;In most cases it frees you from having to add any memory management logic to&amp;nbsp;your application. The downside to automatic garbage collection is that you can&#39;t&amp;nbsp;completely control when it runs and when it doesn&#39;t.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: red; font-size: x-large;&quot;&gt;&lt;b&gt;Overview of Java&#39;s Garbage Collector&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: red; font-size: x-large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;Let&#39;s look at what we mean when we talk about garbage collection in the land of&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Java. From the 30,000 ft. level, garbage collection is the phrase used to describe&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;automatic memory management in Java. Whenever a software program executes (in&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Java, C, C++, Lisp, Ruby, and so on), it uses memory in several different ways. We&#39;re&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;not going to get into Computer Science 101 here, but it&#39;s typical for memory to be&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;used to create a stack, a heap, in Java&#39;s case constant pools, and method areas. The&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;heap is that part of memory where Java objects live, and it&#39;s the one and only part of&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;memory that is in any way involved in the garbage collection process.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;A heap is a heap is a heap. For the exam it&#39;s important to know that you can call it the&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;heap, you can call it the garbage collectible heap, or you can call it Johnson, but there is&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;one and only one heap.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;So, all of garbage collection revolves around making sure that the heap has as&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;much free space as possible. For the purpose of the exam, what this boils down to&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;is deleting any objects that are no longer reachable by the Java program running.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;We&#39;ll talk more about what reachable means, but let&#39;s drill this point in. When&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;the garbage collector runs, its purpose is to find and delete objects that cannot be&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;reached. If you think of a Java program as being in a constant cycle of creating the&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;objects it needs (which occupy space on the heap), and then discarding them when&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;they&#39;re no longer needed, creating new objects, discarding them, and so on, the&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;missing piece of the puzzle is the garbage collector. When it runs, it looks for those&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: inherit; font-size: large;&quot;&gt;discarded objects and deletes them from memory so that the cycle of using memory&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: inherit; font-size: large;&quot;&gt;and releasing it can continue. Ah, the great circle of life.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: inherit; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;color: red; font-size: x-large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;When Does the Garbage Collector Run?&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;color: red; font-size: x-large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;The garbage collector is under the control of the JVM. The JVM decides when to&amp;nbsp;run the garbage collector. From within your Java program you can ask the JVM to&amp;nbsp;run the garbage collector, but there are no guarantees, under any circumstances, that&amp;nbsp;the JVM will comply. Left to its own devices, the JVM will typically run the garbage&amp;nbsp;collector when it senses that memory is running low. Experience indicates that when&amp;nbsp;your Java program makes a request for garbage collection, the JVM will usually grant&amp;nbsp;your request in short order, but there are no guarantees. Just when you think you can&amp;nbsp;count on it, the JVM will decide to ignore your request.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-size: x-large;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: red; font-size: x-large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; How Does the Garbage Collector Work?&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: red; font-size: x-large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;You just can&#39;t be sure. You might hear that the garbage collector uses a mark and&amp;nbsp;sweep algorithm, and for any given Java implementation that might be true, but the&amp;nbsp;Java specification doesn&#39;t guarantee any particular implementation. You might hear&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;
&lt;div&gt;
that the garbage collector uses reference counting; once again maybe yes maybe no.&amp;nbsp;The important concept to understand for the exam is when does an object become&amp;nbsp;eligible for garbage collection? To answer this question fully, we have to jump ahead&lt;/div&gt;
&lt;div&gt;
a little bit and talk about threads. (See Chapter 9 for the real scoop on threads.) In a&amp;nbsp;nutshell, every Java program has from one to many threads. Each thread has its own&amp;nbsp;little execution stack. Normally, you (the programmer) cause at least one thread to&amp;nbsp;run in a Java program, the one with the main() method at the bottom of the stack.&amp;nbsp;However, as you&#39;ll learn in excruciating detail in Chapter 9, there are many really&amp;nbsp;cool reasons to launch additional threads from your initial thread. In addition to&amp;nbsp;having its own little execution stack, each thread has its own lifecycle. For now,&amp;nbsp;all we need to know is that threads can be alive or dead. With this background&amp;nbsp;information, we can now say with stunning clarity and resolve that an object is eligible&amp;nbsp;for garbage collection when no live thread can access it. (Note: Due to the vagaries of&amp;nbsp;the String constant pool, the exam focuses its garbage collection questions on non-String objects, and so our garbage collection discussions apply to only non-String&amp;nbsp;objects too.)&amp;nbsp;Based on that definition, the garbage collector does some magical, unknown&amp;nbsp;operations, and when it discovers an object that can&#39;t be reached by any live thread,&lt;/div&gt;
&lt;div&gt;
it will consider that object as eligible for deletion, and it might even delete it at&amp;nbsp;some point. (You guessed it; it also might not ever delete it.) When we talk about&amp;nbsp;reaching an object, we&#39;re really talking about having a reachable reference variable&amp;nbsp;that refers to the object in question. If our Java program has a reference variable&lt;/div&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;that refers to an object, and that reference variable is available to a live thread, then&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;that object is considered reachable. We&#39;ll talk more about how objects can become&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;unreachable in the following section.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Can a Java application run out of memory? Yes. The garbage collection system&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;attempts to remove objects from memory when they are not used. However, if&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;you maintain too many live objects (objects referenced from other live objects),&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;the system can run out of memory. Garbage collection cannot ensure that there&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;is enough memory, only that the memory that is available will be managed as&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;efficiently as possible.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techs4.blogspot.com/feeds/4506026167029029631/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techs4.blogspot.com/2012/03/garbage-collection-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/4506026167029029631'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/4506026167029029631'/><link rel='alternate' type='text/html' href='http://techs4.blogspot.com/2012/03/garbage-collection-in-java.html' title='Garbage Collection in Java'/><author><name>Gagandeep Singh</name><uri>http://www.blogger.com/profile/01502339043741247951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9030977462820689825.post-8649729656148059069</id><published>2012-03-05T03:46:00.002-05:00</published><updated>2012-03-05T03:46:14.664-05:00</updated><title type='text'></title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;266&#39; src=&#39;https://www.youtube.com/embed/3CR9TKfTuX8?feature=player_embedded&#39; frameborder=&#39;0&#39;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
This is basically for all those hard-core coders so that they sit properly before the laptop and their neck doesn&#39;t pain..!!!...&lt;span style=&quot;color: red; font-size: large;&quot;&gt;&lt;b&gt;please follow it..!!&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techs4.blogspot.com/feeds/8649729656148059069/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techs4.blogspot.com/2012/03/this-is-basically-for-all-those-hard.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/8649729656148059069'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/8649729656148059069'/><link rel='alternate' type='text/html' href='http://techs4.blogspot.com/2012/03/this-is-basically-for-all-those-hard.html' title=''/><author><name>Gagandeep Singh</name><uri>http://www.blogger.com/profile/01502339043741247951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9030977462820689825.post-2359851452078524593</id><published>2012-03-04T14:12:00.000-05:00</published><updated>2012-03-04T14:14:03.682-05:00</updated><title type='text'>Boxing and Unboxing in Java</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;b&gt;&lt;span style=&quot;color: red; font-size: large;&quot;&gt;Boxing and Unboxing in Java&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: red; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit; font-size: large;&quot;&gt;Boxing and Unboxing make using wrapper classes more&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: inherit; font-size: large;&quot;&gt;convenient&lt;/span&gt;&lt;span style=&quot;font-family: inherit; font-size: large;&quot;&gt;.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit; font-size: large;&quot;&gt;In Java 5,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: inherit; font-size: large;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;font-family: inherit; font-size: large;&quot;&gt;&amp;nbsp;feature came, and it was Auto-boxing and Auto-unboxing.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit; font-size: large;&quot;&gt;In the old, pre-Java 5 days, if you wanted to make a wrapper, unwrap it, use it, and then rewrap it, you might do something like this:&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: inherit; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: magenta;&quot;&gt; Integer y = new Integer(56); &amp;nbsp; &amp;nbsp; &amp;nbsp; // make it&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: magenta; font-family: inherit; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int x= y.intValue(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// unwrap it&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: magenta; font-family: inherit; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x++; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// use it&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: magenta; font-family: inherit; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; y = new Integer(x); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // re-wrap it&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: magenta; font-family: inherit; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.out.println(&quot;y =&quot; + y); &amp;nbsp; &amp;nbsp;// print it&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Now improved version of Java 5 you can say,&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: magenta;&quot;&gt; &amp;nbsp; Integer y = new Integer(56); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //make it&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: magenta; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; y++; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//unwrap-it, increment-it, rewrap-it&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: magenta; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.out.println(&quot;y = &quot; + y); &amp;nbsp; &amp;nbsp;// print it&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Both Examples produce the output::&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: magenta;&quot;&gt; y=57&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Behind the scenes, the compiler does the unboxing and reassignment for &amp;nbsp;you.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&amp;nbsp;We knew that wrapper objects are immutable, this example appears to contradict that statement. It sure looks like y&#39;s value changes fro 56 to 57.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: large;&quot;&gt;What actually happened, is that second wrapper object was created and its value was set to 57.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: large;&quot;&gt;We could only prove it as:-&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: magenta;&quot;&gt;&amp;nbsp; Integer y = 56; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // make a wrapper&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: magenta; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Integer x = y; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// assign a second ref var to the wrapper&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: magenta; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: magenta; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;System.out.println(y==x);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: magenta; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;y++; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //unwrap, use , rewrap&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: magenta; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.out.println(x+ &quot; &quot; + y); &amp;nbsp; &amp;nbsp; &amp;nbsp; // print values&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: magenta; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: magenta; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;System.out.println(y==x); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//verify that they refer&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: magenta; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// to different objects&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&amp;nbsp; Which produces the output:&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: magenta;&quot;&gt;&amp;nbsp; true&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: magenta; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 56 57&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: magenta; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; false&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-size: large;&quot;&gt;So under the covers when the compiler &amp;nbsp;got to the line y++; it had to substitute something like this:&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: magenta;&quot;&gt; &amp;nbsp;int x2 = y.intValue(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // unwrap it&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: magenta; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;x2++;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: magenta; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;y = new Integer(x2); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // rewrap-it&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Where Boxing Can Be Used&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-size: large;&quot;&gt;It is very common to use wrappers in conjunction with collections.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Any time you want your collection to hold objects and primitives, you &#39;ll want to us wrappers to make those primitives collection-compatible.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: large;&quot;&gt;The general rule is that boxing and unboxing work wherever you can normally use a primitive or a wrapped object.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style=&quot;color: red; font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;color: red; font-weight: bold;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt; class UseBoxing {&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: magenta; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public static void main(String args[])&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: magenta; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: magenta; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;UseBoxing u = new UseBoxing();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: magenta; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; u.go(5);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: magenta; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: magenta; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; boolean go(Integer i)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: magenta; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: magenta; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Boolean ifSo = true; &amp;nbsp; &amp;nbsp; &amp;nbsp;//boxes the int&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: magenta; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Short s = 400; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//boxes the literal&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: magenta; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(ifSo)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: magenta;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;{ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// unboxing&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;color: magenta;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;System.out.println(++s); &amp;nbsp; //unboxes, increments,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;color: magenta;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// reboxes.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;color: magenta;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: magenta; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return !ifSo;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: magenta; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: magenta; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: red; font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techs4.blogspot.com/feeds/2359851452078524593/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techs4.blogspot.com/2012/03/boxing-and-unboxing-in-java.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/2359851452078524593'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/2359851452078524593'/><link rel='alternate' type='text/html' href='http://techs4.blogspot.com/2012/03/boxing-and-unboxing-in-java.html' title='Boxing and Unboxing in Java'/><author><name>Gagandeep Singh</name><uri>http://www.blogger.com/profile/01502339043741247951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9030977462820689825.post-7450392434024890849</id><published>2012-01-16T12:48:00.000-05:00</published><updated>2012-04-07T02:18:30.865-04:00</updated><title type='text'></title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt;

  var _gaq = _gaq || [];
  _gaq.push([&#39;_setAccount&#39;, &#39;UA-30661081-1&#39;]);
  _gaq.push([&#39;_trackPageview&#39;]);

  (function() {
    var ga = document.createElement(&#39;script&#39;); ga.type = &#39;text/javascript&#39;; ga.async = true;
    ga.src = (&#39;https:&#39; == document.location.protocol ? &#39;https://ssl&#39; : &#39;http://www&#39;) + &#39;.google-analytics.com/ga.js&#39;;
    var s = document.getElementsByTagName(&#39;script&#39;)[0]; s.parentNode.insertBefore(ga, s);
  })();

&lt;/script&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: blue; font-family: Georgia, serif; font-size: 24pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: lime; background-image: initial; background-origin: initial; color: blue; font-family: Georgia, serif; font-size: 24pt;&quot;&gt;Vector Class in J2SE&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Georgia, serif; font-size: 13.5pt;&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul type=&quot;disc&quot;&gt;&lt;li class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: blue; font-family: Georgia, serif; font-size: 13.5pt;&quot;&gt;It      extends AbstractList, which is also a class in java.&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;ul type=&quot;disc&quot;&gt;&lt;li class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: blue; font-family: Georgia, serif; font-size: 13.5pt;&quot;&gt;It      implements List, RandomAccess, Cloneable, Serializable, these are      interfaces in java.&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;ul type=&quot;disc&quot;&gt;&lt;li class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: blue; font-family: Georgia, serif; font-size: 13.5pt;&quot;&gt;Like      an array, it contains components that can be accessed using an integer index.      However, the size of vector can grow or shrink as needed to accomodate      adding and removing items after the vector has been created.&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;ul type=&quot;disc&quot;&gt;&lt;li class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: blue; font-family: Georgia, serif; font-size: 13.5pt;&quot;&gt;Each      Vector tries to optimize storage management by maintaining a capacity and      a capacityIncrement.&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;ul type=&quot;disc&quot;&gt;&lt;li class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: blue; font-family: Georgia, serif; font-size: 13.5pt;&quot;&gt;Vector      Size &amp;lt;= Capacity.&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;label class=&quot;classforlonglabels&quot;&gt;&lt;br /&gt;
&lt;/label&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techs4.blogspot.com/feeds/7450392434024890849/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techs4.blogspot.com/2012/01/servlet-and-jsp-technology-has-become.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/7450392434024890849'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9030977462820689825/posts/default/7450392434024890849'/><link rel='alternate' type='text/html' href='http://techs4.blogspot.com/2012/01/servlet-and-jsp-technology-has-become.html' title=''/><author><name>Gagandeep Singh</name><uri>http://www.blogger.com/profile/01502339043741247951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>