<?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-898086704675792229</id><updated>2026-01-25T23:49:59.352-08:00</updated><category term="Python"/><category term="C programming"/><category term="Tips and Tricks"/><category term="Assembly language"/><category term="Batch File Code"/><category term="Java"/><category term="C Tricky Code"/><category term="C programming tips"/><category term="Algorithm"/><category term="C project"/><category term="JAVA Project"/><category term="Numerical"/><category term="CasparCG"/><category term="Spring"/><category term="openGL"/><category term="Flex-Bison-Lex-Yacc"/><category term="Javascript"/><category term="Mathematics"/><category term="SQL"/><category term="php"/><category term="prolog"/><category term="website"/><category term="Django"/><category term="Hibernate"/><category term="JSP/Servlet"/><category term="Linux"/><category term="Redis"/><category term="Node.js"/><category term="Version Control System"/><category term="Perl"/><category term="Jenkins"/><category term="Oracle"/><category term="Swing"/><category term="wordpress"/><title type='text'>PROGRAMMER</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://programmerts.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://programmerts.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>megamind</name><uri>http://www.blogger.com/profile/06223681390997604722</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>251</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-898086704675792229.post-4173289784446147970</id><published>2018-01-20T11:30:00.000-08:00</published><updated>2018-01-20T11:30:38.499-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><title type='text'>extract item from list of dictionaries</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
obj = {&#39;data&#39;:[{&#39;id&#39;:1,&#39;price&#39;:200,&#39;distance&#39;:20},{&#39;id&#39;:5,&#39;price&#39;:300,&#39;distance&#39;:30},{&#39;id&#39;:6,&#39;price&#39;:225,&#39;distance&#39;:22.5}]}&lt;br /&gt;
&lt;br /&gt;
prince = 300&lt;br /&gt;
&lt;br /&gt;
try:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; print(next(x for x in obj[&#39;data&#39;] if x[&#39;price&#39;] == 300)[&#39;price&#39;])&lt;br /&gt;
except :&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; print(&#39;not found&#39;)&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://programmerts.blogspot.com/feeds/4173289784446147970/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmerts.blogspot.com/2018/01/extract-item-from-list-of-dictionaries.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/4173289784446147970'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/4173289784446147970'/><link rel='alternate' type='text/html' href='http://programmerts.blogspot.com/2018/01/extract-item-from-list-of-dictionaries.html' title='extract item from list of dictionaries'/><author><name>megamind</name><uri>http://www.blogger.com/profile/06223681390997604722</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-898086704675792229.post-8534336929150197896</id><published>2017-12-17T11:04:00.003-08:00</published><updated>2017-12-17T11:04:49.163-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><title type='text'>Javascript functions</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
1.&lt;br /&gt;
var multiply = new Function(&#39;x&#39;, &#39;y&#39;, &#39;return x * y&#39;);&lt;br /&gt;
console.log(multiply(2,9));&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;A function defined with the Function constructor assigned to the variable multiply&lt;br /&gt;
&lt;br /&gt;
2.&lt;br /&gt;
function multiply(x,y){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return x*y;&lt;br /&gt;}&lt;br /&gt;console.log(multiply(2,9));&lt;br /&gt;
&lt;br /&gt;
A function declaration of a function named multiply&lt;br /&gt;
Function declarations in JavaScript are hoisting the function definition&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function&quot;&gt;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
3.&lt;br /&gt;
A function expression of an anonymous function assigned to the variable multiply:&lt;br /&gt;
&lt;br /&gt;
var multiply = function(x,y) {&lt;br /&gt;return x*y;&lt;br /&gt;}&lt;br /&gt;console.log(multiply(2,9));&lt;br /&gt;
&lt;br /&gt;
A function expression of a function named func_name assigned to the variable multiply:&lt;br /&gt;
&lt;br /&gt;
var multiply = function func_name_(x,y) {&lt;br /&gt;return x*y;&lt;br /&gt;}&lt;br /&gt;console.log(multiply(2,9));&lt;br /&gt;
&lt;br /&gt;
*&amp;nbsp; Function expressions in JavaScript are not hoisted&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/function&quot;&gt;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/function&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
4. var a = (x,y) =&amp;gt; { return x*y; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(a(2,9));&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions&quot;&gt;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
5.&lt;br /&gt;
(function(){&lt;br /&gt;console.log(2*9);&lt;br /&gt;})();&lt;br /&gt;
&lt;br /&gt;
Immediately Invokable Function Expression&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions&quot;&gt;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://programmerts.blogspot.com/feeds/8534336929150197896/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmerts.blogspot.com/2017/12/javascript-functions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/8534336929150197896'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/8534336929150197896'/><link rel='alternate' type='text/html' href='http://programmerts.blogspot.com/2017/12/javascript-functions.html' title='Javascript functions'/><author><name>megamind</name><uri>http://www.blogger.com/profile/06223681390997604722</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-898086704675792229.post-6378278421113118845</id><published>2017-12-15T02:45:00.003-08:00</published><updated>2017-12-15T02:45:52.918-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><title type='text'>javascript : map()</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
The &lt;b&gt;map()&lt;/b&gt; method creates a new array with the results of calling a provided function on every element in the calling array.&lt;br /&gt;
&lt;br /&gt;
var numbers = [1, 4, 9];&lt;br /&gt;
var doubles = numbers.map(function(num) {&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; return num * 2;&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
var numbers = [1, 4, 9];&lt;br /&gt;
var doubles = numbers.map(x =&amp;gt; x*2);&lt;br /&gt;
&lt;br /&gt;
another example&lt;br /&gt;
&lt;br /&gt;
var numbers = [1, 4, 9];&lt;br /&gt;
var roots = numbers.map(Math.sqrt);&lt;br /&gt;
console.log(roots);&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
var numbers = [1, 4, 9];&lt;br /&gt;
numbers.map(function(n){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return Math.sqrt(n);&lt;br /&gt;}); &lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map&quot;&gt;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map&lt;/a&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://programmerts.blogspot.com/feeds/6378278421113118845/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmerts.blogspot.com/2017/12/javascript-map.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/6378278421113118845'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/6378278421113118845'/><link rel='alternate' type='text/html' href='http://programmerts.blogspot.com/2017/12/javascript-map.html' title='javascript : map()'/><author><name>megamind</name><uri>http://www.blogger.com/profile/06223681390997604722</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-898086704675792229.post-4896396239277599524</id><published>2017-11-26T04:16:00.000-08:00</published><updated>2017-11-26T04:16:45.777-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><title type='text'>fetch meta information from website </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
from bs4 import BeautifulSoup&lt;br /&gt;import urllib&lt;br /&gt;import requests&lt;br /&gt;&lt;br /&gt;url = &#39;http://www.bbc.com/future/story/20171124-what-if-all-animals-had-human-intelligence&#39;&lt;br /&gt;#page = urllib.urlopen(url).read()&lt;br /&gt;agent = {&quot;User-Agent&quot;: &quot;Mozilla/5.0&quot;}&lt;br /&gt;page = requests.get(url, headers=agent).text&lt;br /&gt;soup = BeautifulSoup(page,&#39;html.parser&#39;)&lt;br /&gt;&lt;br /&gt;try:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; title = soup.find(&quot;title&quot;).text&lt;br /&gt;except:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; title = &quot;no title found&quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;try:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; desc = soup.find(&quot;meta&quot;, property=&quot;og:description&quot;)[&#39;content&#39;].encode(&#39;utf-8&#39;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; except:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:&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; desc = soup.find(attrs={&#39;name&#39;: &#39;Description&#39;})[&#39;content&#39;].encode(&#39;utf-8&#39;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; except:&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; desc = soup.find(attrs={&#39;name&#39;: &#39;description&#39;})[&#39;content&#39;].encode(&#39;utf-8&#39;)&lt;br /&gt;except:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; desc = &quot;no description&amp;nbsp; found&quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;try:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; image = soup.find(&quot;meta&quot;, property=&quot;og:image&quot;)[&#39;content&#39;].encode(&#39;utf-8&#39;)&lt;br /&gt;except:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; image = &quot;no image found&quot;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;try:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; keywords = soup.find(attrs={&#39;name&#39;: &#39;Keywords&#39;})[&#39;content&#39;].encode(&#39;utf-8&#39;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; except:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; keywords = soup.find(attrs={&#39;name&#39;: &#39;keywords&#39;})[&#39;content&#39;].encode(&#39;utf-8&#39;)&lt;br /&gt;except:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; keywords = &#39;NA&#39;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;print &quot;Title : &quot;,title&lt;br /&gt;print &quot;Image : &quot;,image&lt;br /&gt;print &quot;Description : &quot;,desc&lt;br /&gt;print &quot;Keywords : &quot;,keywords&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://programmerts.blogspot.com/feeds/4896396239277599524/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmerts.blogspot.com/2017/11/fetch-meta-information-from-website.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/4896396239277599524'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/4896396239277599524'/><link rel='alternate' type='text/html' href='http://programmerts.blogspot.com/2017/11/fetch-meta-information-from-website.html' title='fetch meta information from website '/><author><name>megamind</name><uri>http://www.blogger.com/profile/06223681390997604722</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-898086704675792229.post-476730168804678473</id><published>2017-11-26T02:11:00.001-08:00</published><updated>2017-11-26T02:11:36.241-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Django"/><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><title type='text'>create Django rest application </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
1. install rest framework&lt;br /&gt;
&lt;br /&gt;
pip install djangorestframework&lt;br /&gt;
&lt;br /&gt;
2. add&amp;nbsp; &#39;rest_framework&#39;, into INSTALLED_APPS from settings.py&lt;br /&gt;
&lt;br /&gt;
3. configure database ,add databse configuration in settings.py&lt;br /&gt;
&lt;br /&gt;
DATABASES = {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;default&#39;: {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;ENGINE&#39;: &#39;django.db.backends.mysql&#39;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;NAME&#39;: &#39;webbookmark&#39;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;USER&#39;: &#39;root&#39;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;PASSWORD&#39;: &#39;password&#39;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;HOST&#39;: &#39;127.0.0.1&#39;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;PORT&#39;: &#39;3306&#39;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;
4. create our model in models.py&lt;br /&gt;
&lt;br /&gt;
class Websites(models.Model):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; link = models.CharField(max_length=500)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; img = models.CharField(max_length=500)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; title = models.CharField(max_length=500)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; content = models.CharField(max_length=500)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; keywords = models.CharField(max_length=250)&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; def __str__(self):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return self.title&lt;br /&gt;
&lt;br /&gt;
5. create a serializer , create a file serializer.py , and include this code&lt;br /&gt;
&lt;br /&gt;
from rest_framework.serializers import ModelSerializer&lt;br /&gt;from .models import Websites&lt;br /&gt;
class WebsitesSerializer(ModelSerializer):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; class Meta:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; model = Websites&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fields = &#39;__all__&#39;&lt;br /&gt;
&lt;br /&gt;
here we want to apply operations (create , update , delete) on all fields&lt;br /&gt;
if we dont want to work with all fields , then we should add&lt;br /&gt;
fields = (&#39;id&#39;, &#39;link&#39;, &#39;img&#39;, &#39;title&#39;)&lt;br /&gt;
&lt;br /&gt;
6. from views.py add viewsets&lt;br /&gt;
&lt;br /&gt;
class WebsitesViewSet(ModelViewSet):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; queryset = Websites.objects.all()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; serializer_class = WebsitesSerializer&lt;br /&gt;&lt;br /&gt;router = DefaultRouter()&lt;br /&gt;router.register(&#39;websites&#39;,WebsitesViewSet)&lt;br /&gt;
&lt;br /&gt;
7. from urls.py , add router urls&lt;br /&gt;
&lt;br /&gt;
urlpatterns = [&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url(r&#39;^api/&#39;, include(router.urls)),&lt;br /&gt;]&lt;br /&gt;
&lt;br /&gt;
8. give command&lt;br /&gt;
python manage.py makemigrations&lt;br /&gt;
python manage.py migrate&lt;br /&gt;
python manage.py runserver&lt;br /&gt;
&lt;br /&gt;
9. now we can control or manage rest request from&lt;br /&gt;
http://localhost:8000/api/websites/&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://programmerts.blogspot.com/feeds/476730168804678473/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmerts.blogspot.com/2017/11/create-django-rest-application.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/476730168804678473'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/476730168804678473'/><link rel='alternate' type='text/html' href='http://programmerts.blogspot.com/2017/11/create-django-rest-application.html' title='create Django rest application '/><author><name>megamind</name><uri>http://www.blogger.com/profile/06223681390997604722</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-898086704675792229.post-4590469614733987630</id><published>2017-11-24T10:35:00.000-08:00</published><updated>2017-11-24T10:35:09.292-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><title type='text'>python decorator </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b&gt;higher-order function&lt;/b&gt; :&amp;nbsp; is a function that takes one or more functions as arguments (i.e., procedural parameters), returns a function as its result.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;decorator&lt;/b&gt; : function that takes another function and extends the behavior of the latter function without explicitly modifying it&lt;br /&gt;
&lt;br /&gt;
In Python, functions can be passed around, and used as arguments, just like any other value (e.g, string, int, float).&lt;br /&gt;
&lt;br /&gt;
def test(val):&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; return val + 1&lt;br /&gt;
&lt;br /&gt;
def call_test(func,val):&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; return func(val)&lt;br /&gt;
&lt;br /&gt;
print call_test(test,5)&lt;br /&gt;
&lt;br /&gt;
output : 6&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;b&gt;nested functions &lt;/b&gt;: in Python, you can define functions inside other functions. Such functions are called nested functions.&lt;br /&gt;
&lt;br /&gt;
def a():&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; def b():&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return &quot;call b()&quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; def c():&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return &quot;call c()&quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; return b()+&quot; and &quot;+c()&lt;br /&gt;
&lt;br /&gt;
print a()&lt;br /&gt;
&lt;br /&gt;
output : call b() and call c()&lt;br /&gt;
&lt;br /&gt;
If we call b(), we should get an error:&lt;br /&gt;
&lt;br /&gt;
Traceback (most recent call last):&lt;br /&gt;&amp;nbsp; File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;&lt;br /&gt;NameError: name &#39;b&#39; is not defined&lt;/module&gt;&lt;/stdin&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
we can change this a() function like :&lt;br /&gt;
&lt;br /&gt;
def a(num):&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; def b():&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return &quot;call b()&quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; def c():&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return &quot;call c()&quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; if num == 1:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return b&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; else:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return c&lt;br /&gt;
&lt;br /&gt;
func = a(2)&lt;br /&gt;
print func()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
output : call c()&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Python allows to simplify the calling of decorators using the @ symbol&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def modified(func):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; def wrap():&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print &quot;start calling function&quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; func()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print &quot;end function&quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return wrap&lt;br /&gt;&lt;br /&gt;def modified_with_args(func):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; def wrap(*args, **kwargs):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print &quot;calling function with param &quot;,args&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return func(*args, **kwargs)+20&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return wrap&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;@modified&lt;br /&gt;def func1():&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print &quot;call func1()&quot;&lt;br /&gt;&lt;br /&gt;@modified_with_args&lt;br /&gt;def func2(num):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return num&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;func1()&lt;br /&gt;print func2(20)&lt;br /&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://programmerts.blogspot.com/feeds/4590469614733987630/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmerts.blogspot.com/2017/11/python-decorator.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/4590469614733987630'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/4590469614733987630'/><link rel='alternate' type='text/html' href='http://programmerts.blogspot.com/2017/11/python-decorator.html' title='python decorator '/><author><name>megamind</name><uri>http://www.blogger.com/profile/06223681390997604722</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-898086704675792229.post-748506122040947660</id><published>2017-11-23T12:15:00.001-08:00</published><updated>2017-11-23T12:15:20.045-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="CasparCG"/><category scheme="http://www.blogger.com/atom/ns#" term="Node.js"/><title type='text'>read OSC messages from casparcg</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
1. install &lt;a href=&quot;https://github.com/colinbdclark/osc.js&quot; target=&quot;_blank&quot;&gt;osc.js&lt;/a&gt;&lt;a href=&quot;https://www.blogger.com/null&quot;&gt;&amp;nbsp;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
npm install osc&lt;br /&gt;
&lt;br /&gt;
2. sample code for listening OSC messages from casparcg server&lt;br /&gt;
&lt;br /&gt;
var osc = require(&#39;osc&#39;)&lt;br /&gt;// Create an osc.js UDP Port listening on port 7250.&lt;br /&gt;var udpPort = new osc.UDPPort({&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; localAddress: &quot;127.0.0.1&quot;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; localPort: 7250,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; metadata: true&lt;br /&gt;});&lt;br /&gt;&lt;br /&gt;// Listen for incoming OSC bundles.&lt;br /&gt;udpPort.on(&quot;message&quot;, function (oscMessage, info) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(&quot; MESSAGE : &quot;, oscMessage);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(oscMessage.address);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(oscMessage.args[0].type);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(oscMessage.args[0].value);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(&#39;===========================&#39;);&lt;br /&gt;});&lt;br /&gt;&lt;br /&gt;// Open the socket.&lt;br /&gt;udpPort.open(); &lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://programmerts.blogspot.com/feeds/748506122040947660/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmerts.blogspot.com/2017/11/read-osc-messages-from-casparcg.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/748506122040947660'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/748506122040947660'/><link rel='alternate' type='text/html' href='http://programmerts.blogspot.com/2017/11/read-osc-messages-from-casparcg.html' title='read OSC messages from casparcg'/><author><name>megamind</name><uri>http://www.blogger.com/profile/06223681390997604722</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-898086704675792229.post-6973357252424865439</id><published>2017-11-20T04:24:00.001-08:00</published><updated>2017-11-20T04:37:16.922-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Jenkins"/><title type='text'>download and start jenkins </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
1. download jenkins from https://jenkins.io/download/&lt;br /&gt;
I have downloaded generic java package (.war)&lt;br /&gt;
&lt;br /&gt;
2. to start jenkins&lt;br /&gt;
goto jenkins.war file location and give command&lt;br /&gt;
&lt;br /&gt;
java -jar jenkins.war&lt;br /&gt;
&lt;br /&gt;
it will start jenkins in 8080 port&lt;br /&gt;
&lt;br /&gt;
if we want to start jenkins in another port&lt;br /&gt;
&lt;br /&gt;
java -jar jenkins.war --httpPort=9090&lt;br /&gt;
&lt;br /&gt;
jenkins will start in 9090 port&lt;br /&gt;
&lt;br /&gt;
save the administrator password to use it later&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
3. now goto http://localhost:8080/ and give administrator password&lt;br /&gt;
&lt;br /&gt;
4. to install plugins , select plugins to install ,click all and install &lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://programmerts.blogspot.com/feeds/6973357252424865439/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmerts.blogspot.com/2017/11/download-and-start-jenkins.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/6973357252424865439'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/6973357252424865439'/><link rel='alternate' type='text/html' href='http://programmerts.blogspot.com/2017/11/download-and-start-jenkins.html' title='download and start jenkins '/><author><name>megamind</name><uri>http://www.blogger.com/profile/06223681390997604722</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-898086704675792229.post-2614733213512887762</id><published>2017-11-02T12:12:00.005-07:00</published><updated>2017-11-02T12:12:51.488-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>JVM</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b&gt;What Is Virtual Machine ?&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
VM acts as runtime engines to run particular programming language applications&lt;br /&gt;
JVM (Java virtual machine)&lt;br /&gt;
PVM (Parallel Virtual Machine) acts as runtime engine to run Perl&lt;br /&gt;
CLR ( Common Language Runtime) acts as runtime engine to run .net&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;What Is A Java Virtual Machine?&lt;/b&gt;&lt;br /&gt;
create a Java program,&lt;br /&gt;
compile this program.&lt;br /&gt;
The result of this compilation is the file with extension .class. It contains Java bytecode.&lt;br /&gt;
generated bytecode is identical no matter on what platform program has been compiled. It is platform neutral. That is why we can say that Java program is platform independent.&lt;br /&gt;
&lt;br /&gt;
However bytecode can not be executed because system understands machine instructions.&lt;br /&gt;
In order to execute a Java program, we have to install a middleware component that fits between Java program and operating system. This component is called Java Virtual Machine.&lt;br /&gt;
&lt;br /&gt;
JVM runs as an application on top of an operating system.&lt;br /&gt;
JVM&amp;nbsp; reproduce Operating system environment for Java programs. Thats why it is called Java Virtual Machine.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Basic Architecture Diagram Of JVM&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;1. Class Loader SubSystem&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Loading&lt;/b&gt; :The Class loader reads the .class file, generate the corresponding binary data and save it in method area.&amp;nbsp;&lt;br /&gt;
&lt;b&gt;Linking&lt;/b&gt; :&amp;nbsp; Performs verification, preparation, and (optionally) resolution.&lt;br /&gt;
&lt;b&gt;Initialization&lt;/b&gt; : In this phase, all static variables are assigned with their values defined in the code and static block(if any). This is executed from top to bottom in a class and from parent to child in class hierarchy. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;2. Memory Management Area&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;b&gt;Method area &lt;/b&gt;: all class level information like class name, immediate parent class name, methods and variables information etc. are stored, including static variables.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Heap area &lt;/b&gt;: Information of all objects is stored in heap area.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Stack area : &lt;/b&gt;For every thread, JVM create one run-time stack which is stored here. Every block of this stack is called activation record/stack frame which store methods calls. All local variables of that method are stored in their corresponding frame.The stack area is thread safe. &lt;/li&gt;
&lt;li&gt;&lt;b&gt;PC Registers : &lt;/b&gt;Each thread will have separate PC Registers, to hold the address of current executing instruction once the instruction is executed the PC register will be updated with the next instruction.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Native method stacks :&lt;/b&gt; For every thread, separate native stack is created. It stores native method information.&lt;/li&gt;
&lt;/ol&gt;
&lt;b&gt;&amp;nbsp;3. Execution Engine&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
The Execution Engine of JVM is Responsible for executing the program and it contains two parts.&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Interpreter.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;JIT Compiler (just in time compiler).&lt;/li&gt;
&lt;/ol&gt;
&lt;b&gt;&amp;nbsp;Java Native Interface (JNI)&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
It is a interface which interacts with the Native Method Libraries&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Native Method Libraries&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
It is a collection of the Native Libraries(C, C++) which are required by the Execution Engine.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://codepumpkin.com/jvm-architecture-introduction/&quot;&gt;http://codepumpkin.com/jvm-architecture-introduction/&lt;/a&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://programmerts.blogspot.com/feeds/2614733213512887762/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmerts.blogspot.com/2017/11/jvm.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/2614733213512887762'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/2614733213512887762'/><link rel='alternate' type='text/html' href='http://programmerts.blogspot.com/2017/11/jvm.html' title='JVM'/><author><name>megamind</name><uri>http://www.blogger.com/profile/06223681390997604722</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-898086704675792229.post-2568543701635597165</id><published>2017-11-01T11:09:00.001-07:00</published><updated>2017-11-01T11:09:09.077-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Mathematics"/><title type='text'>Naive Bayes algorithm</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;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhykaQKTSjrkMqO4yafEZJR1O6YhSCtJrY2RhUQ_FrVl8qoncmfmkLaXIkWqHDxdVBPaXmPhUGe8vrXttD1fvfQFIO34ic5OY5lxIpRTzgzVbF1BDu-wT5uUa8OLTNfzhM2QE_ekXKFNA/s1600/Bayes_rule-300x172.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;172&quot; data-original-width=&quot;300&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhykaQKTSjrkMqO4yafEZJR1O6YhSCtJrY2RhUQ_FrVl8qoncmfmkLaXIkWqHDxdVBPaXmPhUGe8vrXttD1fvfQFIO34ic5OY5lxIpRTzgzVbF1BDu-wT5uUa8OLTNfzhM2QE_ekXKFNA/s1600/Bayes_rule-300x172.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
Above,&amp;nbsp;&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;P(c|x) is the posterior probability of class (c, target) given predictor (x, attributes).&amp;nbsp;&lt;/li&gt;
&lt;li&gt;P(c) is the prior probability of class.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;P(x|c) is the likelihood which is the probability of predictor given class.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;P(x) is the prior probability of predictor.&lt;/li&gt;
&lt;/ul&gt;
we know&lt;br /&gt;
Probability of the joint of events A and B is&lt;br /&gt;
P(A and B) = P( probability of A given B)*P(probability of B)&lt;br /&gt;
P(A and B) = P(A|B)*P(B)&lt;br /&gt;
or&lt;br /&gt;
P(A and B) = P( probability of B given A)*P(probability of A)&lt;br /&gt;
P(A and B) = P(B|A)*P(A)&lt;br /&gt;
so ,&amp;nbsp; P(A|B)*P(B) = P(B|A)*P(A)&lt;br /&gt;
=&amp;gt;&amp;nbsp; P(A|B) = (P(B|A)*P(A))/P(B)&lt;br /&gt;
&lt;br /&gt;
this is conditional probability , when 2 events is not independent&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;For example, a fruit may be considered to be an apple if it is&lt;b&gt; red, round, and about 3 inches in diameter&lt;/b&gt;. These features depend on each other to identify an apple. only red , or only round is not feature of an apple . &lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://programmerts.blogspot.com/feeds/2568543701635597165/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmerts.blogspot.com/2017/11/naive-bayes-algorithm.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/2568543701635597165'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/2568543701635597165'/><link rel='alternate' type='text/html' href='http://programmerts.blogspot.com/2017/11/naive-bayes-algorithm.html' title='Naive Bayes algorithm'/><author><name>megamind</name><uri>http://www.blogger.com/profile/06223681390997604722</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/AVvXsEhykaQKTSjrkMqO4yafEZJR1O6YhSCtJrY2RhUQ_FrVl8qoncmfmkLaXIkWqHDxdVBPaXmPhUGe8vrXttD1fvfQFIO34ic5OY5lxIpRTzgzVbF1BDu-wT5uUa8OLTNfzhM2QE_ekXKFNA/s72-c/Bayes_rule-300x172.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-898086704675792229.post-6707650628586326593</id><published>2017-10-31T05:44:00.003-07:00</published><updated>2017-10-31T05:44:53.823-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Hibernate"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>IDENTITY SEQUENCE TABLE (SEQUENCE)</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b&gt;AUTO:&lt;/b&gt; Hibernate selects the generation strategy based on the used dialect,&lt;br /&gt;&lt;b&gt;IDENTITY:&lt;/b&gt; Hibernate relies on an auto-incremented database column to generate the primary key,&lt;br /&gt;&lt;b&gt;SEQUENCE:&lt;/b&gt; Hibernate requests the primary key value from a database sequence,&lt;br /&gt;&lt;b&gt;TABLE:&lt;/b&gt; Hibernate uses a database table to simulate a sequence.&lt;br /&gt;
&lt;br /&gt;
IDENTITY&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;The IDENTITY generator allows an integer/bigint column to be auto-incremented on demand.&lt;/li&gt;
&lt;li&gt;It relies on an auto-incremented database column and lets the database generate a new value with each insert operation&lt;/li&gt;
&lt;li&gt;The increment process happens outside of the current running transaction, so a roll-back may end-up discarding already assigned values&amp;nbsp;&lt;/li&gt;
&lt;li&gt;The increment process is very efficient since it uses a database internal lightweight locking mechanism&lt;/li&gt;
&lt;li&gt;&lt;b&gt;drawback&lt;/b&gt; is that we can’t know the newly assigned value prior to executing the INSERT statement.&lt;/li&gt;
&lt;li&gt;Hibernates disables the JDBC batch support for entities using the IDENTITY generator&lt;/li&gt;
&lt;li&gt;Hibernate requires a primary key value for each managed entity and therefore has to perform the insert statement immediately. This prevents it from using different optimization techniques like JDBC batching. &lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
@Id&lt;br /&gt;@GeneratedValue(strategy = GenerationType.IDENTITY)&lt;br /&gt;@Column(name = &quot;id&quot;, updatable = false, nullable = false)&lt;br /&gt;private Long id;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;SEQUENCE&lt;/b&gt; &lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;A SEQUENCE is a database object that generates incremental integers on each successive request. SEQUENCES are much more flexible than IDENTIFIER columns&amp;nbsp;&lt;/li&gt;
&lt;li&gt;A SEQUENCE is table free and the same sequence can be assigned to multiple columns or tables&lt;/li&gt;
&lt;li&gt;SEQUENCE requires additional select statements to get the next value from a database sequence&amp;nbsp;&lt;/li&gt;
&lt;li&gt;It additional information is not provided, Hibernate will request the next value from its default sequence. this can be changed by referencing the name of a @SequenceGenerator in the generator attribute of the @GeneratedValue annotation.&lt;/li&gt;
&lt;li&gt;@SequenceGenerator annotation lets to define the name of the generator, the name, and schema of the database sequence and the allocation size of the sequence.&lt;/li&gt;
&lt;li&gt;A SEQUENCE may preallocate values to improve performance&lt;/li&gt;
&lt;li&gt;A SEQUENCE may define an incremental step&lt;/li&gt;
&lt;li&gt;A SEQUENCE doesn’t restrict Hibernate JDBC batching&lt;/li&gt;
&lt;li&gt;A SEQUENCE doesn’t restrict Hibernate inheritance models&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
@Id&lt;br /&gt;@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = &quot;book_generator&quot;)&lt;br /&gt;@SequenceGenerator(name=&quot;book_generator&quot;, sequenceName = &quot;book_seq&quot;, allocationSize=50)&lt;br /&gt;@Column(name = &quot;id&quot;, updatable = false, nullable = false)&lt;br /&gt;private Long id;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;TABLE (SEQUENCE)&lt;/b&gt;&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;It simulates a sequence by storing and updating its current value in a database table&lt;/li&gt;
&lt;li&gt;requires the use of pessimistic locks which put all transactions into a sequential order&lt;/li&gt;
&lt;li&gt;row-level locking which comes at a higher cost than IDENTITY or SEQUENCE generators.&lt;/li&gt;
&lt;li&gt;slows down your application -&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;For local transactions, it must open a new JDBC connection, putting more pressure on the current connection pooling mechanism&lt;/li&gt;
&lt;li&gt;For global transactions, it requires suspending the current running transaction. After the sequence value is generated, the actual transaction has to be resumed. so the overall application performance might be affected&lt;/li&gt;
&lt;/ol&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;definitely less efficient than using a native IDENTITY or SEQUENCE.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://programmerts.blogspot.com/feeds/6707650628586326593/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmerts.blogspot.com/2017/10/identity-sequence-table-sequence.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/6707650628586326593'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/6707650628586326593'/><link rel='alternate' type='text/html' href='http://programmerts.blogspot.com/2017/10/identity-sequence-table-sequence.html' title='IDENTITY SEQUENCE TABLE (SEQUENCE)'/><author><name>megamind</name><uri>http://www.blogger.com/profile/06223681390997604722</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-898086704675792229.post-2524507387562343996</id><published>2017-10-31T03:29:00.000-07:00</published><updated>2017-10-31T03:29:07.861-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Hibernate"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>difference save() vs persist()</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Save()&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Returns generated Id after saving. Its Serializable return type.&lt;/li&gt;
&lt;li&gt;INSERT happens immediately, no matter if you are inside or outside of a transaction.&lt;/li&gt;
&lt;li&gt;save() method can return that primary key id value (int id =&amp;nbsp; session.save(k);)&lt;/li&gt;
&lt;li&gt;Saves the value to DB immediately and keeps track of the entity until the end of the session(I have tried to change the entity values outside of the transaction, it does not show any effect when session commits)&lt;/li&gt;
&lt;li&gt;Does not save the changes to the db outside of the transaction.&lt;/li&gt;
&lt;li&gt;Assigns the generated id to the entity you are persisting&lt;/li&gt;
&lt;li&gt;Session.save() for a detached object will create a new row in the table.&lt;/li&gt;
&lt;/ul&gt;
Persist()&lt;br /&gt;&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Does not returns generated Id after saving. Its void return type.&lt;/li&gt;
&lt;li&gt;it will not execute an INSERT statement if it is called outside of transaction boundaries &lt;/li&gt;
&lt;li&gt;Saves the value to DB immediately and keeps track of the entity until the end of the session.(I have tried to change the entity values outside of the transaction, it does not show any effect when session commits)&lt;/li&gt;
&lt;li&gt;Does not save the changes to the db outside of the transaction.&lt;/li&gt;
&lt;li&gt;Assigns the generated id to the entity you are persisting&lt;/li&gt;
&lt;li&gt;session.persist() for a detached object will throw PersistentObjectException as it is not allowed.&lt;/li&gt;
&lt;/ul&gt;
&lt;a href=&quot;http://www.baeldung.com/hibernate-save-persist-update-merge-saveorupdate&quot;&gt;http://www.baeldung.com/hibernate-save-persist-update-merge-saveorupdate&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;https://stackoverflow.com/questions/5862680/whats-the-advantage-of-persist-vs-save-in-hibernate&quot;&gt;https://stackoverflow.com/questions/5862680/whats-the-advantage-of-persist-vs-save-in-hibernate&lt;/a&gt; &lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://programmerts.blogspot.com/feeds/2524507387562343996/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmerts.blogspot.com/2017/10/difference-save-vs-persist.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/2524507387562343996'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/2524507387562343996'/><link rel='alternate' type='text/html' href='http://programmerts.blogspot.com/2017/10/difference-save-vs-persist.html' title='difference save() vs persist()'/><author><name>megamind</name><uri>http://www.blogger.com/profile/06223681390997604722</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-898086704675792229.post-5768455475061911666</id><published>2017-10-31T02:55:00.000-07:00</published><updated>2017-10-31T02:56:00.592-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Hibernate"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>difference between FetchType.LAZY and FetchType.EAGER</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
suppose we have two entities and there&#39;s a relationship between them. For example,&lt;br /&gt;
an entity called University, &lt;br /&gt;
another entity called Student.&lt;br /&gt;
&lt;br /&gt;
The University entity might have some basic properties such as id, name, address, etc. as well as a property called students:&lt;br /&gt;
&lt;br /&gt;
public class University {&lt;br /&gt;
&amp;nbsp;private String id;&lt;br /&gt;
&amp;nbsp;private String name;&lt;br /&gt;
&amp;nbsp;private String address;&lt;br /&gt;
&amp;nbsp;private List&lt;student&gt; students;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;// setters and getters&lt;br /&gt;}&lt;br /&gt;Now when load a University from the database, JPA loads its id, name, and address fields. But we have two options for students: to load it together with the rest of the fields (i.e. eagerly) or to load it on-demand (i.e. lazily) when calling the university&#39;s getStudents() method.&lt;br /&gt;&lt;br /&gt;* When a university has many students it is not efficient to load all of its students.&lt;/student&gt;&lt;br /&gt;
* When they are not needed. So in such like cases, you can declare that you want students to be loaded when they are actually needed. This is called lazy loading.&lt;br /&gt;
&lt;br /&gt;
LAZY = fetch when needed&lt;br /&gt;
EAGER = fetch immediately&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://programmerts.blogspot.com/feeds/5768455475061911666/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmerts.blogspot.com/2017/10/difference-between-fetchtypelazy-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/5768455475061911666'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/5768455475061911666'/><link rel='alternate' type='text/html' href='http://programmerts.blogspot.com/2017/10/difference-between-fetchtypelazy-and.html' title='difference between FetchType.LAZY and FetchType.EAGER'/><author><name>megamind</name><uri>http://www.blogger.com/profile/06223681390997604722</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-898086704675792229.post-8823961788903523309</id><published>2017-10-29T12:39:00.002-07:00</published><updated>2017-10-31T02:56:18.151-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Hibernate"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>hibernate session.save() does not reflect in database</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
we can avoid this issue in 2 ways :&lt;br /&gt;
&lt;br /&gt;
1.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Session session = new AnnotationConfiguration()&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; .configure()&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; .buildSessionFactory()&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; .openSession();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Transaction transaction = session.beginTransaction();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; User user = new User(&quot;abc&quot;, &quot;100&quot;);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try {&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; session.save(user);&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; transaction.commit();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } catch (HibernateException e) {&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; transaction.rollback();&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; e.printStackTrace();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } finally {&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; session.close();&lt;br /&gt;
&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;&lt;br /&gt;
transaction created after openSession().&lt;br /&gt;
&lt;br /&gt;
2.&lt;br /&gt;
adding following line in &quot;&lt;b&gt;hibernate.cfg.xml&lt;/b&gt;&quot;&lt;br /&gt;
&lt;b&gt;&lt;property name=&quot;hibernate.connection.autocommit&quot;&gt;true&lt;/property&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
thus the code will be&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Session session = new AnnotationConfiguration()&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; .configure()&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; .buildSessionFactory()&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; .openSession();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; User user = new User(&quot;abc&quot;, &quot;100&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; session.save(user);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; session.close();&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://programmerts.blogspot.com/feeds/8823961788903523309/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmerts.blogspot.com/2017/10/hibernate-sessionsave-does-not-reflect.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/8823961788903523309'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/8823961788903523309'/><link rel='alternate' type='text/html' href='http://programmerts.blogspot.com/2017/10/hibernate-sessionsave-does-not-reflect.html' title='hibernate session.save() does not reflect in database'/><author><name>megamind</name><uri>http://www.blogger.com/profile/06223681390997604722</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-898086704675792229.post-2929186886566945336</id><published>2017-10-16T05:11:00.001-07:00</published><updated>2017-10-16T05:11:45.920-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Spring"/><title type='text'>Maven : Updating Indexes Not working </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
1. close Spring Tool Suite&lt;br /&gt;
2. Go to [your-workspace-folder]&lt;br /&gt;
3. Remove .metadata/.plugins/org.eclipse.m2e.core/nexus&lt;br /&gt;
4. Remove .metadata/.plugins/org.maven.ide.eclipse/nexus&lt;br /&gt;
5. Restart Spring Tool Suite&lt;br /&gt;
6. remove [your-home-folder]/.m2/repository/.cache/m2e/*&lt;br /&gt;
Click Window -&amp;gt; Show view -&amp;gt; Other -&amp;gt; Maven Repositories In the appeared tab click Global Repositories. Right click on central -&amp;gt; Rebuild Index.&lt;br /&gt;
&lt;br /&gt;
It took me 30 minutes to rebuild it. All the time Progress bar was 0%. Eclipse downloaded about 10Gb in [your-home-folder]/.m2/repository folder. Then it deleted 8Gb.&lt;br /&gt;
&lt;br /&gt;
To check if download is going, just refresh C drive (or the drive .m2 folder is loceted).&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://programmerts.blogspot.com/feeds/2929186886566945336/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmerts.blogspot.com/2017/10/updating-indexes-not-working.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/2929186886566945336'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/2929186886566945336'/><link rel='alternate' type='text/html' href='http://programmerts.blogspot.com/2017/10/updating-indexes-not-working.html' title='Maven : Updating Indexes Not working '/><author><name>megamind</name><uri>http://www.blogger.com/profile/06223681390997604722</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-898086704675792229.post-3084028178936618308</id><published>2017-10-16T01:37:00.001-07:00</published><updated>2017-10-16T01:37:19.074-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Spring"/><title type='text'>STS console Log</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
to enable Spring tool Suite (STS ) full console log , then&lt;br /&gt;
1. goto pivotal-tc-server-developer-3.2.0.RELEASE\base-instance\conf\logging.properties &lt;br /&gt;
2. add/replace this below line&lt;br /&gt;
.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler&lt;br /&gt;
3. restart Pivotal Tc server&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://programmerts.blogspot.com/feeds/3084028178936618308/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmerts.blogspot.com/2017/10/sts-console-log.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/3084028178936618308'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/3084028178936618308'/><link rel='alternate' type='text/html' href='http://programmerts.blogspot.com/2017/10/sts-console-log.html' title='STS console Log'/><author><name>megamind</name><uri>http://www.blogger.com/profile/06223681390997604722</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-898086704675792229.post-6862086454870972581</id><published>2017-10-10T06:23:00.001-07:00</published><updated>2017-10-10T06:23:35.758-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Spring"/><title type='text'>@ExceptionHandler vs @ControllerAdvice</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Spring 3.2 introduced &lt;b&gt;@ControllerAdvice&lt;/b&gt; annotation for handling exceptions in a Spring MVC application. But prior to this version Spring had @ExceptionHandler to handle exceptions.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;@ExceptionHandler :&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;is local to a controller&amp;nbsp;&lt;/li&gt;
&lt;li&gt;only exceptions from this controller is routed to its @ExceptionHandler&lt;/li&gt;
&lt;li&gt;it does not work for another controllers,it works only for specific controllers&lt;/li&gt;
&lt;/ul&gt;
/************************************************** &lt;br /&gt;
@Controller&lt;br /&gt;public class TestController { &lt;br /&gt;
/*&lt;br /&gt;
some other @RequestMapping functions&lt;br /&gt;
*/&lt;br /&gt;
@ExceptionHandler(DataAccessException.class)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public String DatabaseException(DataAccessException ex) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; return &quot;Error&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
/****************************************************&lt;br /&gt;
this @ExceptionHandler only works for this controller.&lt;br /&gt;
------------------------------------------------------------------------------- &lt;br /&gt;
&lt;b&gt;@ControllerAdvice :&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;use for global error handling.&lt;/li&gt;
&lt;li&gt;It also has full control over the body of the response and the status code.&lt;/li&gt;
&lt;li&gt;it applies to all the defined controller.&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
/*****************************************************&lt;br /&gt;
@ControllerAdvice&lt;br /&gt;public class ErrorHandler {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @ExceptionHandler(DataAccessException.class)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public String DatabaseException(DataAccessException ex) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;return &quot;Error&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;
/******************************************************&lt;br /&gt;
&lt;br /&gt;
this exception handler function works for all Controllers .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://programmerts.blogspot.com/feeds/6862086454870972581/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmerts.blogspot.com/2017/10/exceptionhandler-vs-controlleradvice.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/6862086454870972581'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/6862086454870972581'/><link rel='alternate' type='text/html' href='http://programmerts.blogspot.com/2017/10/exceptionhandler-vs-controlleradvice.html' title='@ExceptionHandler vs @ControllerAdvice'/><author><name>megamind</name><uri>http://www.blogger.com/profile/06223681390997604722</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-898086704675792229.post-5586782711960123698</id><published>2017-10-08T08:00:00.002-07:00</published><updated>2017-10-08T08:00:17.638-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>JNDI</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
JNDI = Java Naming and Directory Interface&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Naming and Directory Concepts :&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
1. &lt;b&gt;naming service&lt;/b&gt;--the means by which &lt;b&gt;names&lt;/b&gt; are &lt;b&gt;associated&lt;/b&gt; with &lt;b&gt;objects&lt;/b&gt; &lt;br /&gt;
2. objects are found based on their names.&lt;br /&gt;
3. A naming service&#39;s primary function is to map names to objects&lt;br /&gt;
example :&lt;br /&gt;
&lt;b&gt;www.example.com ==&amp;gt; 192.0.2.5&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;c:\bin\autoexec.bat ==&amp;gt; File Reference&lt;/b&gt;&lt;br /&gt;
4. naming system or naming convention determines the syntax that the name must follow&lt;br /&gt;
5. The association of a name with an object is called a &lt;b&gt;binding&lt;/b&gt;. (A file name is bound to a file)&lt;br /&gt;
6. A reference to the object is placed inside the naming service.&lt;br /&gt;
7. A reference represents information about how to access or &lt;b&gt;communicate with an object&lt;/b&gt; by&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; looking up name. A name just point the object.&lt;br /&gt;
8. A &lt;b&gt;context&lt;/b&gt; is a set of name-to-object bindings.&lt;br /&gt;
9. Every&lt;b&gt; context&lt;/b&gt; has an associated &lt;b&gt;naming convention&lt;/b&gt;. A context always provides a lookup (resolution) operation that returns the object. example : &lt;b&gt;/usr/bin&lt;/b&gt; here , &lt;b&gt;/us&lt;/b&gt;r is context and&lt;br /&gt;
&lt;b&gt;/bin&lt;/b&gt; is &lt;b&gt;subcontext&lt;/b&gt;. /usr is used to lookup /bin. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Naming Package&lt;/b&gt;&lt;br /&gt;
1.&amp;nbsp; &lt;b&gt;javax.naming&lt;/b&gt; package contains classes and interfaces for accessing &lt;b&gt;naming services&lt;/b&gt;&lt;br /&gt;
2. l&lt;b&gt;ookup()&lt;/b&gt; use to look up object by name, and it returns the object bound to that name.&lt;br /&gt;
3. &lt;b&gt;Name&lt;/b&gt; is an &lt;b&gt;interface&lt;/b&gt; that represents a generic name. &lt;b&gt;The Naming Systems&lt;/b&gt; use this &lt;b&gt;interface&lt;/b&gt; to define the &lt;b&gt;names&lt;/b&gt; that follow its conventions.&lt;br /&gt;
4. &lt;b&gt;References :&lt;/b&gt; The &lt;b&gt;JNDI&lt;/b&gt; &lt;b&gt;defines the Reference class&lt;/b&gt; to represent reference.&lt;br /&gt;
5. &lt;b&gt;A reference&lt;/b&gt; contains information on how to construct a copy of the object.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Directory Package&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
1. The &lt;b&gt;javax.naming.directory&lt;/b&gt; package extends the &lt;b&gt;javax.naming&lt;/b&gt; package to provide functionality for accessing directory services in addition to naming services.&lt;br /&gt;
2. This package allows applications to &lt;b&gt;retrieve objects&lt;/b&gt; stored in the directory and&lt;b&gt; search for objects&lt;/b&gt; using specified attributes&lt;b&gt; &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;JNDI &lt;/b&gt;&lt;br /&gt;
1.&lt;b&gt; JNDI&lt;/b&gt; just use references(how to construct a copy of the object)&amp;nbsp; that are looked up from the directory to make Java objects that they represent , and thus &lt;b&gt;JNDI clients&lt;/b&gt; have an idea/illusion that &lt;b&gt;what is stored in the directory are Java objects.&lt;/b&gt;&lt;br /&gt;
2. In the JNDI, all &lt;b&gt;naming and directory operations&lt;/b&gt; are performed relative to a &lt;b&gt;context&lt;/b&gt;.(&lt;span style=&quot;-webkit-text-stroke-width: 0px; color: black; display: inline !important; float: none; font-family: Arial, Helvetica, sans-serif; font-size: 12.8px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;no absolute roots)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; color: black; display: inline !important; float: none; font-family: Arial, Helvetica, sans-serif; font-size: 12.8px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;3. &lt;b&gt;JNDI&lt;/b&gt; defines an &lt;b&gt;InitialContext&lt;/b&gt;, which provides a starting point for naming and directory operations.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; color: black; display: inline !important; float: none; font-family: Arial, Helvetica, sans-serif; font-size: 12.8px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;4. &lt;b&gt;initial context&lt;/b&gt; use to look up other contexts and objects.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; color: black; display: inline !important; float: none; font-family: Arial, Helvetica, sans-serif; font-size: 12.8px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; color: black; display: inline !important; float: none; font-family: Arial, Helvetica, sans-serif; font-size: 12.8px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;b&gt;Overview of JNDI&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; color: black; display: inline !important; float: none; font-family: Arial, Helvetica, sans-serif; font-size: 12.8px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;1. The JNDI architecture consists of an &lt;b&gt;API&lt;/b&gt; and a&lt;b&gt; service provider interface (SPI)&lt;/b&gt;.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; color: black; display: inline !important; float: none; font-family: Arial, Helvetica, sans-serif; font-size: 12.8px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;2. Java applications use the &lt;b&gt;JNDI API&lt;/b&gt; to &lt;b&gt;access&lt;/b&gt; a variety of &lt;b&gt;naming and directory services.&lt;/b&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; color: black; display: inline !important; float: none; font-family: Arial, Helvetica, sans-serif; font-size: 12.8px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;3. The &lt;b&gt;SPI&lt;/b&gt; enables a variety of naming and directory services to be plugged in transparently,allowing the Java application using the JNDI API to access their services.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; color: black; display: inline !important; float: none; font-family: Arial, Helvetica, sans-serif; font-size: 12.8px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; color: black; display: inline !important; float: none; font-family: Arial, Helvetica, sans-serif; font-size: 12.8px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;4.&amp;nbsp; &lt;b&gt;basic use of JNDI&lt;/b&gt; allows distributed applications to &lt;b&gt;look up services&lt;/b&gt; in an abstract, resource-independent way.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; color: black; display: inline !important; float: none; font-family: Arial, Helvetica, sans-serif; font-size: 12.8px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;5. &lt;b&gt;Typical uses of JNDI&lt;/b&gt; include:&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; color: black; display: inline !important; float: none; font-family: Arial, Helvetica, sans-serif; font-size: 12.8px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;connecting a Java application to an external directory service (such as an address database or an LDAP server)&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; color: black; display: inline !important; float: none; font-family: Arial, Helvetica, sans-serif; font-size: 12.8px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;allowing a Java Servlet to&lt;b&gt; look up configuration information&lt;/b&gt; provided by the hosting web container&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; color: black; display: inline !important; float: none; font-family: Arial, Helvetica, sans-serif; font-size: 12.8px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;most common use case is to set up a database connection pool on a Java EE application server. Any application that&#39;s deployed on that server can access to the connections.They only need JNDI name without having to know the details about the connection.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; color: black; display: inline !important; float: none; font-family: Arial, Helvetica, sans-serif; font-size: 12.8px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;user can use the &lt;b&gt;same JNDI name&lt;/b&gt; in each environment and can hide the actual database being used. Applications don&#39;t have to change if they migrate between environments.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; color: black; display: inline !important; float: none; font-family: Arial, Helvetica, sans-serif; font-size: 12.8px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&amp;nbsp;&lt;b&gt;safer&lt;/b&gt; alternative to having a properties file with jdbc connection info or exposing database connection info.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; color: black; display: inline !important; float: none; font-family: Arial, Helvetica, sans-serif; font-size: 12.8px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&amp;nbsp;Java EE app server needs to know only JNDI, not &lt;/span&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; color: black; display: inline !important; float: none; font-family: Arial, Helvetica, sans-serif; font-size: 12.8px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; color: black; display: inline !important; float: none; font-family: Arial, Helvetica, sans-serif; font-size: 12.8px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;necessary to know credentials for accessing a production database.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;a href=&quot;https://docs.oracle.com/javase/tutorial/jndi/overview/index.html&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; color: black; display: inline !important; float: none; font-family: Arial, Helvetica, sans-serif; font-size: 12.8px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;b&gt;https://docs.oracle.com/javase/tutorial/jndi/overview/index.html&lt;/b&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; color: black; display: inline !important; float: none; font-family: Arial, Helvetica, sans-serif; font-size: 12.8px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;b&gt;&lt;a href=&quot;https://stackoverflow.com/questions/4365621/what-is-jndi-what-is-its-basic-use-when-is-it-used&quot;&gt;https://stackoverflow.com/questions/4365621/what-is-jndi-what-is-its-basic-use-when-is-it-used&lt;/a&gt; &lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; color: black; display: inline !important; float: none; font-family: Arial, Helvetica, sans-serif; font-size: 12.8px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://programmerts.blogspot.com/feeds/5586782711960123698/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmerts.blogspot.com/2017/10/jndi.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/5586782711960123698'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/5586782711960123698'/><link rel='alternate' type='text/html' href='http://programmerts.blogspot.com/2017/10/jndi.html' title='JNDI'/><author><name>megamind</name><uri>http://www.blogger.com/profile/06223681390997604722</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-898086704675792229.post-1676671680856956613</id><published>2017-10-07T04:35:00.000-07:00</published><updated>2017-10-07T04:36:16.404-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Spring"/><title type='text'>Spring Auto scanning components, wiring from beans and autowiring </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
1. we declare all the beans or components in XML bean configuration file, so that Spring container can detect and register your beans or components&lt;br /&gt;
2. Spring is able to auto scan, detect and instantiate beans from project package also.&lt;br /&gt;
&lt;br /&gt;
declare beans from xml&lt;br /&gt;
----------------------------&lt;br /&gt;
&lt;b&gt;Normal bean.&lt;/b&gt;&lt;br /&gt;
package com.customer.dao;&lt;br /&gt;
public class CustomerDAO&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; public String toString() {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; return &quot;Hello , This is CustomerDAO&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;DAO layer.&lt;/b&gt;&lt;br /&gt;
package com.customer.services;&lt;br /&gt;
import com.customer.dao.CustomerDAO;&lt;br /&gt;
public class CustomerService&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CustomerDAO customerDAO;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; public void setCustomerDAO(CustomerDAO customerDAO) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; this.customerDAO = customerDAO;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; public String toString() {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; return &quot;CustomerService [customerDAO=&quot; + customerDAO + &quot;]&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;beans.xml&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;beans br=&quot;&quot; xmlns=&quot;http://www.springframework.org/schema/beans&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xsi:schemaLocation=&quot;http://www.springframework.org/schema/beans&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; http://www.springframework.org/schema/beans/spring-beans-2.5.xsd&quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;bean class=&quot;com.customer.services.CustomerService&quot; id=&quot;customerService&quot;&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;property name=&quot;customerDAO&quot; ref=&quot;customerDAO&quot;&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/property&gt;&lt;/bean&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;bean class=&quot;com.customer.dao.CustomerDAO&quot; id=&quot;customerDAO&quot;&gt;&lt;br /&gt;&lt;/bean&gt;&lt;/beans&gt;&lt;br /&gt;
&lt;br /&gt;
here we have wired classes through &#39;ref&#39;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;App class&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
package com.common;&lt;br /&gt;
import org.springframework.context.ApplicationContext;&lt;br /&gt;
import org.springframework.context.support.ClassPathXmlApplicationContext;&lt;br /&gt;
import com.customer.services.CustomerService;&lt;br /&gt;
&lt;br /&gt;
public class App&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void main( String[] args )&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; ApplicationContext context =&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; new ClassPathXmlApplicationContext(new String[] {&quot;beans.xml&quot;});&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; CustomerService cust = (CustomerService)context.getBean(&quot;customerService&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(cust);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
output: CustomerService [customerDAO=Hello , This is CustomerDAO]&lt;br /&gt;
&lt;br /&gt;
we can do this by auto scanning classes and annotation wiring&lt;br /&gt;
&lt;br /&gt;
Auto Components Scanning&lt;br /&gt;
&lt;br /&gt;
1. enable Spring auto component scanning features&lt;br /&gt;
Annotate with &lt;b&gt;@Component&lt;/b&gt; to indicate this is class is an auto scan component.&lt;br /&gt;
&lt;br /&gt;
package com.customer.dao;&lt;br /&gt;
&lt;br /&gt;
import org.springframework.stereotype.Component;&lt;br /&gt;
&lt;br /&gt;
@Component&lt;br /&gt;
public class CustomerDAO&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; public String toString() {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; return &quot;Hello , This is CustomerDAO&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;DAO layer&lt;/b&gt;, add @&lt;b&gt;Component &lt;/b&gt;to indicate this is an auto scan component also.&lt;br /&gt;
&lt;br /&gt;
package com.customer.services;&lt;br /&gt;
import org.springframework.beans.factory.annotation.Autowired;&lt;br /&gt;
import org.springframework.stereotype.Component;&lt;br /&gt;
import com.customer.dao.CustomerDAO;&lt;br /&gt;
&lt;br /&gt;
@Component&lt;br /&gt;
public class CustomerService&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; @Autowired&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CustomerDAO customerDAO;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; public String toString() {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; return &quot;CustomerService [customerDAO=&quot; + customerDAO + &quot;]&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
or ,&lt;br /&gt;
package com.customer.services;&lt;br /&gt;
import org.springframework.beans.factory.annotation.Autowired;&lt;br /&gt;
import org.springframework.stereotype.Component;&lt;br /&gt;
import com.customer.dao.CustomerDAO;&lt;br /&gt;
&lt;br /&gt;
@Component&lt;br /&gt;
public class CustomerService&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CustomerDAO customerDAO;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; @Autowired&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; public void setCustomerDAO(CustomerDAO customerDAO) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; this.customerDAO = customerDAO;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; public String toString() {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; return &quot;CustomerService [customerDAO=&quot; + customerDAO + &quot;]&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@Autowired just do the setter things.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;beans.xml&lt;/b&gt;&lt;br /&gt;
enable auto scanning feature in Spring by adding “context:component” in bean configuration file.&lt;br /&gt;
&lt;br /&gt;
&lt;beans br=&quot;&quot; xmlns=&quot;http://www.springframework.org/schema/beans&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:context=&quot;http://www.springframework.org/schema/context&quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xsi:schemaLocation=&quot;http://www.springframework.org/schema/beans&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; http://www.springframework.org/schema/beans/spring-beans-2.5.xsd&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; http://www.springframework.org/schema/context&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; http://www.springframework.org/schema/context/spring-context-2.5.xsd&quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;context:component-scan base-package=&quot;com.customer&quot;&gt;&lt;br /&gt;&lt;/context:component-scan&gt;&lt;/beans&gt;&lt;br /&gt;
&lt;br /&gt;
The &lt;b&gt;base-package&lt;/b&gt; is indicate where &lt;b&gt;components&lt;/b&gt; stored, Spring will scan this folder and find out the bean (&lt;b&gt;annotated with @Component&lt;/b&gt;) and register it in Spring container.&lt;br /&gt;
&lt;br /&gt;
we can add &#39;component-scan&#39; from Spring Tool Suite IDE.&lt;br /&gt;
to do it ,&lt;br /&gt;
1. click on &lt;br /&gt;
beans.xml &amp;gt; context &amp;gt; select beans(right click on beans) &amp;gt; select insert&lt;context:component-scan&gt; element&lt;br /&gt;2. click on component-scan &amp;gt; give base package (com.customer,where java code reside) and save&lt;/context:component-scan&gt;&lt;br /&gt;
&lt;br /&gt;
App class :&lt;br /&gt;
&lt;br /&gt;
package com.common;&lt;br /&gt;
&lt;br /&gt;
import org.springframework.context.ApplicationContext;&lt;br /&gt;
import org.springframework.context.support.ClassPathXmlApplicationContext;&lt;br /&gt;
&lt;br /&gt;
import com.customer.services.CustomerService;&lt;br /&gt;
&lt;br /&gt;
public class App&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void main( String[] args )&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; ApplicationContext context =&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; new ClassPathXmlApplicationContext(new String[] {&quot;beans.xml&quot;});&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; CustomerService cust = (CustomerService)context.getBean(&quot;customerService&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(cust);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
output : CustomerService [customerDAO=Hello , This is CustomerDAO]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://www.mkyong.com/spring/spring-auto-scanning-components/&quot; target=&quot;_blank&quot;&gt;https://www.mkyong.com/spring/spring-auto-scanning-components/&lt;/a&gt;&amp;nbsp;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://programmerts.blogspot.com/feeds/1676671680856956613/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmerts.blogspot.com/2017/10/spring-auto-scanning-components-wiring.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/1676671680856956613'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/1676671680856956613'/><link rel='alternate' type='text/html' href='http://programmerts.blogspot.com/2017/10/spring-auto-scanning-components-wiring.html' title='Spring Auto scanning components, wiring from beans and autowiring '/><author><name>megamind</name><uri>http://www.blogger.com/profile/06223681390997604722</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-898086704675792229.post-4991669721982865876</id><published>2017-09-30T12:10:00.001-07:00</published><updated>2017-09-30T12:10:22.906-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>Object class in Java</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
* Object class is present in &lt;b&gt;java.lang&lt;/b&gt; package&lt;br /&gt;
&lt;br /&gt;
* If a Class does not extend any other class then it is direct &lt;b&gt;child class of Object&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
* If extends other class then it is an indirectly derived&lt;br /&gt;
&lt;br /&gt;
* Object &lt;b&gt;class methods&lt;/b&gt; are available to all Java classes&lt;br /&gt;
&lt;br /&gt;
* There are &lt;b&gt;12 methods&lt;/b&gt; in Object class&lt;br /&gt;
&lt;br /&gt;
* &lt;b&gt;toString() :&lt;/b&gt;&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;toString() provides String representation of an Object&lt;/li&gt;
&lt;li&gt;used to convert an object to String.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;The default toString() method for class Object returns a string consisting of the &lt;b&gt;name of the class&lt;/b&gt; of which the object is an instance, the at-sign character&lt;b&gt; `@’&lt;/b&gt;, and the unsigned &lt;b&gt;hexadecimal representation&lt;/b&gt; of the hash code of the object. example : A@1fee6fc&lt;/li&gt;
&lt;/ul&gt;
public String toString() {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return getClass().getName() + &quot;@&quot; + Integer.toHexString(hashCode());&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
* always recommended to override toString() method to get our own String representation of Object.&lt;br /&gt;
&lt;br /&gt;
*&lt;b&gt;hashCode() :&lt;/b&gt;&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;For every &lt;b&gt;object&lt;/b&gt;, JVM generates a unique number which is hashcode.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;It returns &lt;b&gt;distinct integers for distinct objects&lt;/b&gt;.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;A &lt;b&gt;common misconception&lt;/b&gt; about this method is that hashCode() method returns the address of object, which is &lt;b&gt;not correct&lt;/b&gt;.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;hashCode() converts the internal address of object to an integer by using an algorithm.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;hashCode() method is &lt;b&gt;native&lt;/b&gt; because in Java it is &lt;b&gt;impossible&lt;/b&gt; to find address of an object, so it uses native languages like C/C++ to find address of the object.&lt;/li&gt;
&lt;li&gt;hashCode() method : Returns a hash value that is used to search object in a collection.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;JVM(Java Virtual Machine) uses hashcode method while saving objects into hashing related data structures like HashSet, HashMap, Hashtable etc.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;The main advantage of saving objects based on hash code is that searching becomes easy.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
* &lt;b&gt;equals(Object obj) :&lt;/b&gt;&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Compares the given object to “this” object (the object on which the method is called).&amp;nbsp;&lt;/li&gt;
&lt;li&gt;It gives a generic way to compare objects for equality.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;It is recommended to override equals(Object obj) method to get our own equality condition on Objects.&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;It is generally necessary to override the &lt;b&gt;hashCode()&lt;/b&gt; method whenever &lt;b&gt;equals()&lt;/b&gt;&amp;nbsp; method is overridden, so as to maintain the general contract for the hashCode method, which states that equal &lt;b&gt;objects must have equal hash codes.&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;b&gt;*&amp;nbsp; getClass() :&lt;/b&gt;&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Returns the class object of “this” object&amp;nbsp;&lt;/li&gt;
&lt;li&gt;used to &lt;b&gt;get actual runtime class&lt;/b&gt; of the object.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;It can also be used to get &lt;b&gt;metadata&lt;/b&gt; of this class.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;The returned Class object is the object that is &lt;b&gt;locked by static synchronized methods&lt;/b&gt; of the represented class.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;As it is final so we &lt;b&gt;don’t override&lt;/b&gt; it.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
public class Test&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void main(String[] args)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Object obj = new String(&quot;GeeksForGeeks&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Class c = obj.getClass();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(&quot;Class of Object obj is : &quot;&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;&amp;nbsp;&amp;nbsp; + c.getName());&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;
Class of Object obj is : &lt;b&gt;java.lang.String&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;* &lt;/b&gt;After loading a &lt;b&gt;.class&lt;/b&gt; file, JVM will create an object of the type &lt;b&gt;java.lang.Class&lt;/b&gt; in the &lt;b&gt;Heap area&lt;/b&gt;. We can use this class object to get Class level information. It is widely used in &lt;b&gt;Reflection&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;finalize() method :&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;This method is called just before an object is garbage collected.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;It is called by the &lt;b&gt;Garbage Collector&lt;/b&gt; on an object when garbage collector determines that there are no more references to the object.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;We should &lt;b&gt;override finalize()&lt;/b&gt; method to &lt;b&gt;dispose system resources&lt;/b&gt;, p&lt;b&gt;erform clean-up&lt;/b&gt; activities and &lt;b&gt;minimize memory leaks&lt;/b&gt;.&lt;/li&gt;
&lt;li&gt;finalize method is&lt;b&gt; called just once on an object&lt;/b&gt; even though that object is eligible for garbage collection multiple times. &lt;b&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;we can override finalize() method for perform our cleanup activities like closing connection from database.&lt;b&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;finalize() method called by Garbage Collector not JVM&lt;b&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;If an &lt;b&gt;uncaught exception&lt;/b&gt; is thrown by the finalize() method,&lt;b&gt; the exception is ignored&lt;/b&gt; and finalization of that object terminates.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
public class Test&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void main(String[] args) throws InterruptedException&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Test t1 = new Test();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Test t2 = new Test(); &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; t1 = null;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // requesting JVM for running Garbage Collector&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.gc();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; t2 = null;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // requesting JVM for running Garbage Collector&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Runtime.getRuntime().gc();&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; protected void finalize() throws Throwable&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(&quot;Garbage collector called&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(&quot;Object garbage collected : &quot; + this);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;
output&lt;br /&gt;
Garbage collector called&lt;br /&gt;Object garbage collected : Test@46d08f12&lt;br /&gt;Garbage collector called&lt;br /&gt;Object garbage collected : Test@481779b8&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Clone() :&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Object cloning refers to creation of exact copy of an object.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;It creates a new instance of the class of current object&lt;/li&gt;
&lt;li&gt;initializes all its fields with exactly the contents of the corresponding fields of this object.&lt;/li&gt;
&lt;li&gt;Every class that implements clone() should call &lt;b&gt;super.clone()&lt;/b&gt; to obtain the cloned object reference.&lt;/li&gt;
&lt;li&gt;class must also implement &lt;b&gt;java.lang.Cloneable&lt;/b&gt; interface whose object clone.otherwise it will throw &lt;b&gt;CloneNotSupportedException&lt;/b&gt; when clone method is called on that class’s object.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
class Test implements Cloneable&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int a,b;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public Object clone() throws&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; CloneNotSupportedException&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return super.clone();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;// Driver class&lt;br /&gt;public class Main&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void main(String args[]) throws&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;&amp;nbsp; CloneNotSupportedException&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Test2 t1 = new Test2();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; t1.a = 10;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; t1.b = 20;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Test2 t2 = (Test2)t1.clone();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; t2.a = 100;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(t1.a + &quot; &quot; + t1.b);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(t2.a + &quot; &quot; + t2.b);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;&lt;div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.geeksforgeeks.org/object-class-in-java/&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;http://www.geeksforgeeks.org/object-class-in-java/&amp;nbsp;&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.geeksforgeeks.org/clone-method-in-java-2/&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;http://www.geeksforgeeks.org/clone-method-in-java-2/&amp;nbsp;&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.geeksforgeeks.org/garbage-collection-java/&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;http://www.geeksforgeeks.org/garbage-collection-java/&amp;nbsp;&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.geeksforgeeks.org/overriding-equals-method-in-java/&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;http://www.geeksforgeeks.org/overriding-equals-method-in-java/ &lt;/b&gt;&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.geeksforgeeks.org/overriding-tostring-method-in-java/&quot;&gt;http://www.geeksforgeeks.org/overriding-tostring-method-in-java/&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;https://www.javatpoint.com/Garbage-Collection&quot; target=&quot;_blank&quot;&gt;https://www.javatpoint.com/Garbage-Collection &lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://programmerts.blogspot.com/feeds/4991669721982865876/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmerts.blogspot.com/2017/09/object-class-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/4991669721982865876'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/4991669721982865876'/><link rel='alternate' type='text/html' href='http://programmerts.blogspot.com/2017/09/object-class-in-java.html' title='Object class in Java'/><author><name>megamind</name><uri>http://www.blogger.com/profile/06223681390997604722</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-898086704675792229.post-1922640766610330236</id><published>2017-09-29T14:01:00.001-07:00</published><updated>2017-09-29T14:02:00.722-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>final keyword in Java</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
* final is a &lt;a href=&quot;http://www.geeksforgeeks.org/access-and-non-access-modifiers-in-java/&quot; target=&quot;_blank&quot;&gt;non-access modifier&lt;/a&gt;&lt;br /&gt;
* &lt;b&gt;final variable&lt;/b&gt; - to create constant variable&lt;br /&gt;
* &lt;b&gt;final methods &lt;/b&gt;- prevent method overriding&lt;br /&gt;
* &lt;b&gt;final classes&lt;/b&gt; - prevent inheritance&lt;br /&gt;
&lt;br /&gt;
&lt;b style=&quot;-webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: black; font-family: &amp;quot;Open Sans&amp;quot;, Helvetica, Arial, Verdana, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; margin: 0px; orphans: 2; padding: 0px; text-align: -webkit-center; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;Final variables :&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;b style=&quot;-webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: black; font-family: &amp;quot;Open Sans&amp;quot;, Helvetica, Arial, Verdana, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; margin: 0px; orphans: 2; padding: 0px; text-align: -webkit-center; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;* variable is declared with final keyword, it’s value can’t be modified&lt;/span&gt;&lt;/span&gt;&lt;b style=&quot;-webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: black; font-family: &amp;quot;Open Sans&amp;quot;, Helvetica, Arial, Verdana, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; margin: 0px; orphans: 2; padding: 0px; text-align: -webkit-center; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b style=&quot;-webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: black; font-family: &amp;quot;Open Sans&amp;quot;, Helvetica, Arial, Verdana, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; margin: 0px; orphans: 2; padding: 0px; text-align: -webkit-center; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;static final double PI = 3.141592653589793;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; border: 0px; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-size: 15px; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-align: -webkit-center; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;* must initialize a final variable, otherwise compiler will throw &lt;b&gt;compile-time error&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; border: 0px; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-size: 15px; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-align: -webkit-center; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;* There are three ways to initialize a final variable :&lt;/span&gt;&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white; border: 0px; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-size: 15px; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-align: -webkit-center; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-size: 15px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;initialize a final variable when it is declared.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white; border: 0px; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-size: 15px; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-align: -webkit-center; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-size: 15px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;A blank final variable can be initialized inside&amp;nbsp;&lt;a href=&quot;http://www.geeksforgeeks.org/instance-initialization-block-iib-java/&quot; target=&quot;_blank&quot;&gt;instance-initializer&lt;/a&gt; block or inside &lt;b&gt;constructor&lt;/b&gt;. If you have more than one constructor in your class then it must be initialized in all of them, otherwise &lt;b&gt;compile time error&lt;/b&gt; will be thrown.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white; border: 0px; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-size: 15px; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-align: -webkit-center; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-size: 15px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&amp;nbsp;A blank final static variable can be initialized inside &lt;a href=&quot;http://www.geeksforgeeks.org/g-fact-79/&quot; target=&quot;_blank&quot;&gt;static block&lt;/a&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&amp;nbsp;&lt;span style=&quot;font-size: small;&quot;&gt;class Gfg &lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; final int THRESHOLD = 5;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; final int CAPACITY;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; final int&amp;nbsp; MINIMUM;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; static final double PI = 3.141592653589793;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; static final double EULERCONSTANT;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CAPACITY = 25;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; static{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EULERCONSTANT = 2.3;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public GFG() &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MINIMUM = -1;&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; &lt;br /&gt;}&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;* final variables must be used only for the values to remain constant throughout the execution of program.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;* When a final variable is a reference to an object, then this final variable is called &lt;b&gt;reference final&lt;/b&gt; variable.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;final StringBuffer sb;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;* final variable cannot be re-assign. But in case of a &lt;b&gt;reference fina&lt;/b&gt;l variable, internal state of the object pointed by that reference variable can be changed.&amp;nbsp; This property of final is called &lt;b&gt;non-transitivity&lt;/b&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;class Gfg&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void main(String[] args) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; final StringBuilder sb = new StringBuilder(&quot;Geeks&quot;);&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; System.out.println(sb);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.append(&quot;ForGeeks&quot;);&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; System.out.println(sb);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp; &lt;br /&gt;}&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;output : Geeks&lt;br /&gt;GeeksForGeeks&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;* Arrays with final keyword are also called final arrays.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;* declare an object variable as final, it means that the variable cannot refer to anything else.&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;class Test &lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int p = 20;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void main(String args[])&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; final Test t = new Test();&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; t.p = 30;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(t.p);&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;}&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;it works fine !!!&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;class Test &lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int p = 20;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void main(String args[])&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; final Test t1 = new Test();&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; Test t2 = new Test();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; t1 = t2; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(t1.p);&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; &lt;br /&gt;}&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;Output: Compiler Error: cannot assign a value to final variable t1&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;* a &lt;b&gt;final array&lt;/b&gt; means that&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;the array variable reference to an object,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;cannot be changed to refer to anything,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;but the members of array can be modified.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;* When a final variable is created inside a &lt;b&gt;method/constructor/block&lt;/b&gt;, it is called &lt;b&gt;local final&lt;/b&gt; variable, and it must initialize once where it is created.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;*&amp;nbsp; &lt;b&gt;final with foreach loop&lt;/b&gt; : final with for-each statement is a &lt;b&gt;legal&lt;/b&gt; statement.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;class Gfg &lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void main(String[] args) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int arr[] = {1, 2, 3};&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (final int i : arr)&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; System.out.print(i + &quot; &quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp; &lt;br /&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&amp;nbsp;Since the i variable goes out of scope with each iteration of the loop, it is actually re-declaration each iteration, allowing the same token (i.e. i) to be used to represent multiple variables.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;final classes :&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&amp;nbsp;* &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;A final class cannot be extended(inherited).&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;final class A&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // methods and fields&lt;br /&gt;}&lt;br /&gt;// The following class is illegal.&lt;br /&gt;class B extends A &lt;br /&gt;{ &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // COMPILE-ERROR! Can&#39;t subclass A&lt;br /&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;* final with classes is to&amp;nbsp;&lt;a href=&quot;http://www.geeksforgeeks.org/create-immutable-class-java/&quot; target=&quot;_blank&quot;&gt;create an immutable class&lt;/a&gt; like the predefined&amp;nbsp;&lt;a href=&quot;http://www.geeksforgeeks.org/string-class-in-java/&quot; target=&quot;_blank&quot;&gt;String&lt;/a&gt; class.You can not make a class immutable without making it final.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;
&lt;b style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot;,&amp;quot;helvetica&amp;quot;,&amp;quot;arial&amp;quot;,&amp;quot;verdana&amp;quot;,sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;Final methods:&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&amp;nbsp;* A final method cannot be overridden. &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&amp;nbsp;* The&amp;nbsp;&lt;a href=&quot;http://www.geeksforgeeks.org/object-class-in-java/&quot; target=&quot;_blank&quot;&gt;Object class&lt;/a&gt; does this—a number of its methods are final&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;* methods with final keyword required to follow the same implementation throughout all the derived classes.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;class A &lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; final void m1() &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;System.out.println(&quot;This is a final method.&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;class B extends A &lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void m1()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;b&gt; &amp;nbsp;// COMPILE-ERROR! Can&#39;t override.&lt;/b&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;System.out.println(&quot;Illegal!&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;* It is illegal to declare a class as both &lt;b&gt;abstract&lt;/b&gt; and &lt;b&gt;final&lt;/b&gt; since an abstract class is incomplete by itself and relies upon its subclasses to provide complete implementations.&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;* &lt;b&gt;A final&lt;/b&gt; class cannot be &lt;b&gt;subclassed&lt;/b&gt;.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;* &lt;b&gt;A final&lt;/b&gt; method cannot be overridden by subclasses&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;a href=&quot;http://www.geeksforgeeks.org/final-keyword-java/&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;http://www.geeksforgeeks.org/final-keyword-java/&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;a href=&quot;http://www.geeksforgeeks.org/using-final-with-inheritance-in-java/&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;http://www.geeksforgeeks.org/using-final-with-inheritance-in-java/&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;a href=&quot;https://stackoverflow.com/questions/15655012/how-final-keyword-works&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;https://stackoverflow.com/questions/15655012/how-final-keyword-works&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;http://www.geeksforgeeks.org/final-arrays-in-java/ &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;background-color: white; border: 0px none; color: black; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; margin: 0px; padding: 0px; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: &amp;quot;open sans&amp;quot; , &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-style: normal; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;b style=&quot;-webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: black; font-family: &amp;quot;Open Sans&amp;quot;, Helvetica, Arial, Verdana, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; margin: 0px; orphans: 2; padding: 0px; text-align: -webkit-center; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;/b&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://programmerts.blogspot.com/feeds/1922640766610330236/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmerts.blogspot.com/2017/09/final-keyword-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/1922640766610330236'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/1922640766610330236'/><link rel='alternate' type='text/html' href='http://programmerts.blogspot.com/2017/09/final-keyword-in-java.html' title='final keyword in Java'/><author><name>megamind</name><uri>http://www.blogger.com/profile/06223681390997604722</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-898086704675792229.post-6782814470496964819</id><published>2017-09-29T09:48:00.001-07:00</published><updated>2017-09-29T09:48:23.563-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>Java Memory Management </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div&gt;
* &lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;Memory management is the process of allocating new objects and removing unused objects to make space for those new object allocations.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;* &lt;/span&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;Java objects reside in an area called&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;em class=&quot;cEmphasis&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: italic; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;the heap&lt;/em&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;* &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;The heap is created when the JVM starts up and may increase or decrease in size while the application runs.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;* &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;When the heap becomes full,&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;em class=&quot;cEmphasis&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: italic; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;garbage &lt;/em&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;is&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;em class=&quot;cEmphasis&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: italic; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;collected.&lt;/em&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;em class=&quot;cEmphasis&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: italic; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;* &lt;/em&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;em class=&quot;cEmphasis&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: italic; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;During the garbage collection objects &lt;b&gt;that are no longer used&lt;/b&gt; are cleared, thus making space for new objects.&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;em class=&quot;cEmphasis&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: italic; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;*&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;em class=&quot;cEmphasis&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: italic; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;The heap is sometimes divided into two areas (or&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;em class=&quot;cEmphasis&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: italic; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;generations&lt;/em&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;) called&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;em class=&quot;cEmphasis&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: italic; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;nursery(young space)&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;em class=&quot;cEmphasis&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: italic; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;em class=&quot;cEmphasis&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: italic; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;/em&gt;&lt;/span&gt; &lt;/em&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;old space&lt;/li&gt;
&lt;/ul&gt;
* &lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;The &lt;b&gt;nursery&lt;/b&gt; is a part of the heap reserved for allocation of new objects&amp;nbsp;&lt;/span&gt; &lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;em class=&quot;cEmphasis&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: italic; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;/em&gt;&lt;em class=&quot;cEmphasis&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: italic; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;/em&gt;&lt;/span&gt;&lt;/span&gt; * &lt;/span&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;The reasoning behind a &lt;b&gt;nursery&lt;/b&gt; is that most objects are temporary and short lived&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;* &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;a &lt;b&gt;young collection&lt;/b&gt; frees a given amount of memory much faster than an &lt;b&gt;old collection&lt;/b&gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;em class=&quot;cEmphasis&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: italic; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;/em&gt;&lt;em class=&quot;cEmphasis&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: italic; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;/em&gt;&lt;/span&gt;&lt;/span&gt;* &lt;/span&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;When the nursery becomes full, garbage is collected by running a special&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span class=&quot;cEmphasis&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13.3333px; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;young collection&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;* all objects are&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;cEmphasis&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13.3333px; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;promoted&lt;/span&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;(moved) to the &lt;b&gt;old space&lt;/b&gt;, thus freeing up the nursery for more object allocation&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;* When the old space becomes full garbage is collected there, a process called an&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span class=&quot;cEmphasis&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13.3333px; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;old collection&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;.&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;*&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: &amp;quot;Open Sans&amp;quot;, Helvetica, Arial, Verdana, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: justify; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt; In Java, when we only declare a variable of &lt;b&gt;a class type&lt;/b&gt;(like &lt;b&gt;Test t;&lt;/b&gt; )&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: &amp;quot;Open Sans&amp;quot;, Helvetica, Arial, Verdana, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: justify; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Consolas, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: pre; widows: 2; word-spacing: 0px;&quot;&gt;&lt;/span&gt;, only a reference is created (&lt;b&gt;memory is not allocated for the object&lt;/b&gt;). To allocate memory to an object, we must use &lt;b&gt;new()&lt;/b&gt;. So the object is always allocated memory on heap&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;b&gt;How java internally works :&lt;/b&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;* An application starts running within a thread by default. Java uses stack memory ( green marked ) to handle this.&lt;/span&gt;&lt;/span&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/AVvXsEgqcnICqVp3AIe-uNzYmSIuXGsk62pYl5MnZt9QQPIUv1nYGAMqTrW5SlOIhDJOMlz-Gjd0GG0ikAcZ6-YH-nmyYSt8MDHzwu34lirVYVrLaJbSyydlPFbmZ0JND9EBc00HF9DYVYDLMg/s1600/java.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;312&quot; data-original-width=&quot;162&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqcnICqVp3AIe-uNzYmSIuXGsk62pYl5MnZt9QQPIUv1nYGAMqTrW5SlOIhDJOMlz-Gjd0GG0ikAcZ6-YH-nmyYSt8MDHzwu34lirVYVrLaJbSyydlPFbmZ0JND9EBc00HF9DYVYDLMg/s1600/java.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;* declare a variable of primitive type,&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;b&gt;int x;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int a;&lt;/b&gt;&lt;/span&gt;&lt;/span&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/AVvXsEhj2UPmEl-uGk7DkSpvyaTywG_Do-OuSERLiP0W7qha74OhEikyJVz33-zjL4BOeTHPZdggxqZVFBaO_4e8rnACMBAuglusweIXeX_JrUTpCXrMyK06rSqZUGRUDK7ypQl9jNeBo3yEgA/s1600/java-3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;312&quot; data-original-width=&quot;162&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhj2UPmEl-uGk7DkSpvyaTywG_Do-OuSERLiP0W7qha74OhEikyJVz33-zjL4BOeTHPZdggxqZVFBaO_4e8rnACMBAuglusweIXeX_JrUTpCXrMyK06rSqZUGRUDK7ypQl9jNeBo3yEgA/s1600/java-3.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&amp;nbsp;Which means &lt;b&gt;x&lt;/b&gt; and &lt;b&gt;a&lt;/b&gt; will take place in &lt;b&gt;main()&lt;/b&gt; method’s memory. That’s why you can’t access local variables of a method from another method.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&amp;nbsp;* we call another method from the main method such as,&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;public static void main(String args[]){&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&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; check();&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&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;/b&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&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; public static void check(){&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/b&gt;&lt;/span&gt;&lt;/span&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/AVvXsEiWgvJ9qK-8K1c4a_PYI6T77_JA34Cp7U817_UxZmlNV5AvWi2YxMlrKOEyya7ycLLl6F_0yD4hN-GVTz46U03NuBKc2wGUuP8g0NvO1FSzZwg6eog_6PCZAHaSIYbF0wIlvS93XpIDHw/s1600/java-4.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;312&quot; data-original-width=&quot;162&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWgvJ9qK-8K1c4a_PYI6T77_JA34Cp7U817_UxZmlNV5AvWi2YxMlrKOEyya7ycLLl6F_0yD4hN-GVTz46U03NuBKc2wGUuP8g0NvO1FSzZwg6eog_6PCZAHaSIYbF0wIlvS93XpIDHw/s1600/java-4.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&amp;nbsp;Different space will be allocated for &lt;b&gt;check()&lt;/b&gt; method.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;*&amp;nbsp; Assume we have a class,&lt;b&gt;Book&lt;/b&gt; let’s have an instance of it in &lt;b&gt;check()&lt;/b&gt; method.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void main(String args[]){&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; check();&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; public static void check(){&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; Book b = new Book();&lt;br /&gt;&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;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/AVvXsEiuHYAWSY031UC6xZaDxy4KLGXXk4HGSim7DVsJp1m_4Z3jPcDVL-fXSCdNugAeNcaUKDkFJ_jUINqa9EICON2trXjDREaskOkg_uJy5O8rtmXjOJhA7iMZe_AnkLhTvZpaC6y_QDCmXg/s1600/java-5.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;352&quot; data-original-width=&quot;722&quot; height=&quot;195&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuHYAWSY031UC6xZaDxy4KLGXXk4HGSim7DVsJp1m_4Z3jPcDVL-fXSCdNugAeNcaUKDkFJ_jUINqa9EICON2trXjDREaskOkg_uJy5O8rtmXjOJhA7iMZe_AnkLhTvZpaC6y_QDCmXg/s400/java-5.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&amp;nbsp;it will create an instance in &lt;b&gt;heap memory&lt;/b&gt; and keep a &lt;b&gt;reference&lt;/b&gt; in check() method’s memory.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;*Java puts &lt;b&gt;primitive types&lt;/b&gt; directly in&lt;b&gt; local memory&lt;/b&gt; but objects in heap and keeps a &lt;b&gt;reference&lt;/b&gt; to it in &lt;b&gt;method memory&lt;/b&gt;.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;* we declare &lt;b&gt;Book c&lt;/b&gt; and assign b to c ( i,e c = b;) it will create a reference to b‘s object.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;* if change anything of c, b value will be updated too. Because&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; everything you pass is Java other than method parameters is &lt;b&gt;passed by reference&lt;/b&gt;.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;Method parameters are &lt;b&gt;passed by value&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;* After completing execution of the method check(), it will be removed from the &lt;b&gt;stack&lt;/b&gt; as well as all references.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;* if we create another thread , &lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp; public static void check(){&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Thread t = new Thread(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void run(){&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; background();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; t.start();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void background(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&lt;/span&gt;&lt;/span&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/AVvXsEhAmjHFkxnSnQSaidYSgvujj5zdI9MHISy3vvoVXu0l3IEv6WPLdMaRWC9vd_7i5wYX4Z0kdqanxKHChdwvN9uY3RU9MLqEwea7UqBv3xK6xgw_0tP4RYLYsH-YzrMFusoq7ZgFp-eIdA/s1600/java-6.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;352&quot; data-original-width=&quot;722&quot; height=&quot;195&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAmjHFkxnSnQSaidYSgvujj5zdI9MHISy3vvoVXu0l3IEv6WPLdMaRWC9vd_7i5wYX4Z0kdqanxKHChdwvN9uY3RU9MLqEwea7UqBv3xK6xgw_0tP4RYLYsH-YzrMFusoq7ZgFp-eIdA/s400/java-6.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&amp;nbsp;As we are running a different thread so it will create a different stack to handle everything of it such as &lt;b&gt;background()&lt;/b&gt; method in thread 2 stacks.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;* &lt;b&gt;String&lt;/b&gt; is &lt;b&gt;immutable&lt;/b&gt; in Java. Immutable means you can’t change it after creation. One of the reasons of it is to &lt;b&gt;save memory&lt;/b&gt; space&lt;/span&gt;&lt;/span&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/AVvXsEhkszvxczEJPFy4QoIs5L4hSRYUqBp7rNUiK19JT9DpJ9TUnDIo6E3DtlAjOwzBsYRB5zT2IOG1cmju0pJ28ruVSwJ3t2voK8JHkGXNJjsE2QpZ4WIe9ufYKinVCaU9vWWMuzK1WzR_eQ/s1600/java-7.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;352&quot; data-original-width=&quot;722&quot; height=&quot;195&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkszvxczEJPFy4QoIs5L4hSRYUqBp7rNUiK19JT9DpJ9TUnDIo6E3DtlAjOwzBsYRB5zT2IOG1cmju0pJ28ruVSwJ3t2voK8JHkGXNJjsE2QpZ4WIe9ufYKinVCaU9vWWMuzK1WzR_eQ/s400/java-7.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;We have a String variable p1 in check() method having a value &lt;b&gt;&quot;abcd&lt;/b&gt;&quot; and it creates a memory space in heap.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;then we have declared p2 having the same value &quot;&lt;b&gt;abcd&quot;&lt;/b&gt;.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;Now it won’t create another abcd in heap rather get a reference to it.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;When method execution complete, only &lt;b&gt;references&lt;/b&gt; will be removed not the &lt;b&gt;object.&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;*&amp;nbsp;&amp;nbsp; &lt;b&gt;==&lt;/b&gt; checks for &lt;b&gt;references&lt;/b&gt; but &lt;b&gt;equals&lt;/b&gt; method checks &lt;b&gt;value&lt;/b&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;*Garbage Collector ( GC ) cleans memory. it looks for unreferenced objects in heap and if found any GC removes it from memory.&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;found the information from :&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;a href=&quot;https://www.blogger.com/goog_1825433218&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;a href=&quot;https://www.blogger.com/null&quot; target=&quot;_blank&quot;&gt;https://docs.oracle.com/cd/E13150_01/jrockit_jvm/jrockit/geninfo/diagnos/garbage_collect.html&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;a href=&quot;https://jugbd.org/2017/09/16/steak-inside-java-inside/&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;https://jugbd.org/2017/09/16/steak-inside-java-inside/&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13.3333px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://programmerts.blogspot.com/feeds/6782814470496964819/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmerts.blogspot.com/2017/09/java-memory-management.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/6782814470496964819'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/6782814470496964819'/><link rel='alternate' type='text/html' href='http://programmerts.blogspot.com/2017/09/java-memory-management.html' title='Java Memory Management '/><author><name>megamind</name><uri>http://www.blogger.com/profile/06223681390997604722</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/AVvXsEgqcnICqVp3AIe-uNzYmSIuXGsk62pYl5MnZt9QQPIUv1nYGAMqTrW5SlOIhDJOMlz-Gjd0GG0ikAcZ6-YH-nmyYSt8MDHzwu34lirVYVrLaJbSyydlPFbmZ0JND9EBc00HF9DYVYDLMg/s72-c/java.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-898086704675792229.post-1248089400198285901</id><published>2017-09-25T12:08:00.001-07:00</published><updated>2017-09-25T12:08:36.489-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Node.js"/><category scheme="http://www.blogger.com/atom/ns#" term="Redis"/><title type='text'>NodeJs with Redis : Read and write data into Redis </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
var redis = require(&quot;redis&quot;),&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; client = redis.createClient();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;client.on(&quot;error&quot;, function (err) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(&quot;Error &quot; + err);&lt;br /&gt;});&lt;br /&gt;&lt;br /&gt;console.log(&quot;todays Schedule:&quot;);&lt;br /&gt;&lt;br /&gt;client.set(&quot;today date&quot;, Date(), redis.print);&lt;br /&gt;&lt;br /&gt;client.hmset(&quot;00:00:00:00&quot;, [&quot;name&quot;, &quot;Drama_Part_1&quot;, &quot;length&quot;, &quot;00:10:01:00&quot;], &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; function (err, res) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(&quot;Response &quot;+res);&lt;br /&gt;});&lt;br /&gt;&lt;br /&gt;client.hmset(&quot;00:10:01:00&quot;, [&quot;name&quot;, &quot;Drama_Part_2&quot;, &quot;length&quot;, &quot;00:05:00:20&quot;], &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; function (err, res) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(&quot;Response &quot;+res);&lt;br /&gt;});&lt;br /&gt;
&lt;br /&gt;client.get(&quot;today date&quot;, function (err, reply) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (err) throw err;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(&quot;Today : &quot;+reply.toString());&lt;br /&gt;});&lt;br /&gt;&lt;br /&gt;client.hkeys(&quot;00:00:00:00&quot;,function(err,replies){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; replies.forEach(function (reply,i){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; client.hget(&quot;00:00:00:00&quot;,reply,function(err,res){&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; console.log(reply+&quot; : &quot;+res);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;br /&gt;});&lt;br /&gt;&lt;br /&gt;client.hkeys(&quot;00:10:01:00&quot;,function(err,replies){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; replies.forEach(function (reply,i){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; client.hget(&quot;00:10:01:00&quot;,reply,function(err,res){&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; console.log(reply+&quot; : &quot;+res);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;br /&gt;client.quit();&lt;br /&gt;});&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://programmerts.blogspot.com/feeds/1248089400198285901/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmerts.blogspot.com/2017/09/nodejs-with-redis-read-and-write-data.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/1248089400198285901'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/1248089400198285901'/><link rel='alternate' type='text/html' href='http://programmerts.blogspot.com/2017/09/nodejs-with-redis-read-and-write-data.html' title='NodeJs with Redis : Read and write data into Redis '/><author><name>megamind</name><uri>http://www.blogger.com/profile/06223681390997604722</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-898086704675792229.post-726708181682860064</id><published>2017-09-25T10:11:00.000-07:00</published><updated>2017-09-25T10:11:12.976-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Node.js"/><title type='text'>Node.js install </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&amp;gt; wget https://nodejs.org/dist/v6.11.3/node-v6.11.3.tar.gz&lt;br /&gt;
&amp;gt; tar xvzf node-v6.11.3.tar.gz&lt;br /&gt;
&amp;gt; cd node-v6.11.3&lt;br /&gt;
&amp;gt; ./configure&lt;br /&gt;
&amp;gt; make&lt;br /&gt;
&amp;gt; make install &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
to test node code :&lt;br /&gt;
&lt;br /&gt;
1. open a file(here my file name &lt;b&gt;test.js&lt;/b&gt;)&lt;br /&gt;
2. copy and paste the code and save it&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;var http = require(&#39;http&#39;);&lt;br /&gt;&lt;br /&gt;http.createServer(function (req, res) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; res.writeHead(200, {&#39;Content-Type&#39;: &#39;text/plain&#39;});&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; res.end(&#39;Hello World!&#39;);&lt;br /&gt;}).listen(8080);&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
3. open command line and give the following command&lt;br /&gt;
&lt;br /&gt;
&amp;gt; &lt;b&gt;node test.js&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
4. open a browser and hit the url &lt;b&gt;http://localhost:8080/&lt;/b&gt;&lt;br /&gt;
the output would be&lt;b&gt; &#39;Hello World!&#39; &lt;/b&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://programmerts.blogspot.com/feeds/726708181682860064/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmerts.blogspot.com/2017/09/nodejs-install.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/726708181682860064'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/726708181682860064'/><link rel='alternate' type='text/html' href='http://programmerts.blogspot.com/2017/09/nodejs-install.html' title='Node.js install '/><author><name>megamind</name><uri>http://www.blogger.com/profile/06223681390997604722</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-898086704675792229.post-4415851470265261553</id><published>2017-09-25T08:28:00.000-07:00</published><updated>2017-09-25T08:28:04.446-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Redis"/><title type='text'>Redis - Publish Subscribe</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;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;b&gt;publisher&lt;/b&gt; : &lt;/span&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;the messaging system where the senders (in redis terminology called publishers) sends the messages&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;b&gt;subscriber&lt;/b&gt; : &lt;/span&gt;&lt;/span&gt;messaging system&amp;nbsp; the receivers (subscribers) receive messages from publisher.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;b style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;channel&lt;/b&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt; : &lt;/span&gt;&lt;/span&gt;The link by which the messages are transferred is called&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;b style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;channel&lt;/b&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;127.0.0.1:6379&amp;gt; subscribe channel1 &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;Reading messages... (press Ctrl-C to quit)&lt;br /&gt;1) &quot;subscribe&quot;&lt;br /&gt;2) &quot;channal1&quot;&lt;br /&gt;3) (integer) 1&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;27.0.0.1:6379&amp;gt; &lt;/span&gt;&lt;/span&gt;publish channel1 &quot;hello&quot;&amp;nbsp;&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;(integer) 1&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;subscribe multiple channel with pattern&amp;nbsp; :&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;127.0.0.1:6379&amp;gt; PSUBSCRIBE abc*&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;127.0.0.1:6379&amp;gt; publish abcc &quot;hello abcc channel&quot;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;(integer) 1&lt;br /&gt;127.0.0.1:6379&amp;gt; publish abctauwab &quot;hello abctauwab channel&quot;&lt;br /&gt;(integer) 1&lt;br /&gt;127.0.0.1:6379&amp;gt; publish random &quot;hello random channel&quot;&lt;br /&gt;(integer) 0&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://programmerts.blogspot.com/feeds/4415851470265261553/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmerts.blogspot.com/2017/09/redis-publish-subscribe.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/4415851470265261553'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/898086704675792229/posts/default/4415851470265261553'/><link rel='alternate' type='text/html' href='http://programmerts.blogspot.com/2017/09/redis-publish-subscribe.html' title='Redis - Publish Subscribe'/><author><name>megamind</name><uri>http://www.blogger.com/profile/06223681390997604722</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>