<?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-3009465146130392037</id><updated>2024-09-27T21:41:13.835-07:00</updated><category term="ArrayList"/><category term="Collection"/><category term="LinkedList"/><category term="List"/><category term="Set"/><category term="catch"/><category term="checked"/><category term="finally"/><category term="rumtime exception"/><category term="try"/><category term="unchecked"/><title type='text'>OCP Java 1.6 Certification Notes</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://ocpjavacertifyme.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3009465146130392037/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://ocpjavacertifyme.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Pintu</name><uri>http://www.blogger.com/profile/18089590556502179121</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>15</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3009465146130392037.post-8915830004653751891</id><published>2012-06-12T10:22:00.003-07:00</published><updated>2012-06-12T10:22:52.446-07:00</updated><title type='text'>Classes and Interfaces</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ocpjavacertifyme.blogspot.com/feeds/8915830004653751891/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ocpjavacertifyme.blogspot.com/2012/06/classes-and-interfaces.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3009465146130392037/posts/default/8915830004653751891'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3009465146130392037/posts/default/8915830004653751891'/><link rel='alternate' type='text/html' href='http://ocpjavacertifyme.blogspot.com/2012/06/classes-and-interfaces.html' title='Classes and Interfaces'/><author><name>Pintu</name><uri>http://www.blogger.com/profile/18089590556502179121</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-3009465146130392037.post-3120276285371702212</id><published>2012-06-12T10:22:00.001-07:00</published><updated>2012-06-13T07:31:57.319-07:00</updated><title type='text'>Garbage Collection in Java</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b&gt;What is Garbage Collection?&lt;/b&gt;&lt;br /&gt;
&amp;nbsp;Objects that are no longer getting referenced are called Garbage and the process of collecting them called as Garbage Collection.&lt;br /&gt;
&lt;br /&gt;
a. The first way to remove reference to a object is to mark it as null.&lt;br /&gt;
&amp;nbsp;Sample Code :&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
&lt;i&gt;Map&amp;lt;String, String&amp;gt; map = new HashMap&amp;lt;String, String&amp;gt;();&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;map.put(&quot;&quot;, &quot;&quot;);&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;map = null; //This is eligible for garbage collection.&amp;nbsp;&amp;nbsp;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
b. All the variables initialised in the method declaration is eligible for Garbage Collection. However, if a method has a return type and if the return type is referencing to any variable then it is not eligible for Garbage Collection. &lt;br /&gt;
In the below example object &quot;str&quot; is not eligible for Garbage Collection.&lt;br /&gt;
&lt;i&gt;public String getStr(){&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;nbsp;String str = &quot;test&quot;;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;nbsp;return str;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;} &lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;public void test() {&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;String str = getStr();&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;}&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;c.&lt;/i&gt; If a variable is reassigned to another variable then it is eligible for Garbage collection.&lt;i&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;
&lt;b&gt;How to Force Garbage Collection?&lt;/b&gt;&lt;br /&gt;
&lt;i&gt;Garbage collector can be forced by calling System.gc() or Runtime.getInstance().gc(); However, nothing is guaranteed.&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;However, JVM ensures to run Garbage Collection before OutofMemory error occurs.&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;b&gt;Finalise&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;docList&quot;&gt;
Is invoked by the garbage collector after it determines that 
this object is no longer reachable and its space is to be reclaimed. This method 
might clean up any non-memory resources used by this object. It is invoked at 
most once per object, even if execution of this method causes the object to 
become reachable again and later it becomes unreachable again. There is no 
guarantee, however, that &lt;tt&gt;finalize&lt;/tt&gt; will be called in any specific time 
period; it may never be called at all. This method is declared to throw any 
exception but if an exception occurs it is ignored by the garbage collector. The 
virtual machine makes no guarantees about which thread will execute the 
&lt;tt&gt;finalize&lt;/tt&gt; method of any given object, but it does guarantee that the 
thread will not hold any user-visible synchronization locks.&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ocpjavacertifyme.blogspot.com/feeds/3120276285371702212/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ocpjavacertifyme.blogspot.com/2012/06/garbage-collection-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3009465146130392037/posts/default/3120276285371702212'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3009465146130392037/posts/default/3120276285371702212'/><link rel='alternate' type='text/html' href='http://ocpjavacertifyme.blogspot.com/2012/06/garbage-collection-in-java.html' title='Garbage Collection in Java'/><author><name>Pintu</name><uri>http://www.blogger.com/profile/18089590556502179121</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-3009465146130392037.post-2952499710011363727</id><published>2012-06-12T10:20:00.002-07:00</published><updated>2012-06-12T10:20:17.137-07:00</updated><title type='text'>Java Declaration and Access Control</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ocpjavacertifyme.blogspot.com/feeds/2952499710011363727/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ocpjavacertifyme.blogspot.com/2012/06/java-declaration-and-access-control.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3009465146130392037/posts/default/2952499710011363727'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3009465146130392037/posts/default/2952499710011363727'/><link rel='alternate' type='text/html' href='http://ocpjavacertifyme.blogspot.com/2012/06/java-declaration-and-access-control.html' title='Java Declaration and Access Control'/><author><name>Pintu</name><uri>http://www.blogger.com/profile/18089590556502179121</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-3009465146130392037.post-5226271959191094731</id><published>2012-06-12T10:19:00.005-07:00</published><updated>2012-06-12T18:42:09.454-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="catch"/><category scheme="http://www.blogger.com/atom/ns#" term="checked"/><category scheme="http://www.blogger.com/atom/ns#" term="finally"/><category scheme="http://www.blogger.com/atom/ns#" term="rumtime exception"/><category scheme="http://www.blogger.com/atom/ns#" term="try"/><category scheme="http://www.blogger.com/atom/ns#" term="unchecked"/><title type='text'>Exception Handling</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Exceptions are conditions which alters normal program flow. They may be enforced by the JVM to terminate the program or any customised business condition which will alter the flow.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVntswajx7anXbEyCWu2HujYN9Rg89mLgoRfjaxB3K-L9HFF-QkYj0UOy2EXj0H_1vXSmS86obvnxECy9bINdt5Lzo3PnAzIOdqGCOuDGN7-M9XxbwbCExzIwv8Cn8YOLqyuB36dqghYI/s1600/exceptions.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;315&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVntswajx7anXbEyCWu2HujYN9Rg89mLgoRfjaxB3K-L9HFF-QkYj0UOy2EXj0H_1vXSmS86obvnxECy9bINdt5Lzo3PnAzIOdqGCOuDGN7-M9XxbwbCExzIwv8Cn8YOLqyuB36dqghYI/s400/exceptions.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;Broadly exceptions are divided into two categories&lt;br /&gt;
&lt;b&gt;a. Checked Exceptions&lt;/b&gt; - Exceptions which the programmer needs to handle in programming else the compiler will complain. Examples are SQLException, IOException etc.&lt;br /&gt;
&lt;b&gt;b. Unchecked Exception&lt;/b&gt; - Exception which the compiler will never complain however they will be generated at runtime. Examples like NullPointerException, IllegalArgumentException, ClassNotFouneException etc.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Handling Exceptions :&lt;/b&gt; This can be done by&lt;br /&gt;
&amp;nbsp;a. try, catch and finally block.&lt;br /&gt;
b. Throws clause&lt;br /&gt;
c. Throw clause&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://ocpjavacertifyme.blogspot.com/feeds/5226271959191094731/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ocpjavacertifyme.blogspot.com/2012/06/exception-handling.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3009465146130392037/posts/default/5226271959191094731'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3009465146130392037/posts/default/5226271959191094731'/><link rel='alternate' type='text/html' href='http://ocpjavacertifyme.blogspot.com/2012/06/exception-handling.html' title='Exception Handling'/><author><name>Pintu</name><uri>http://www.blogger.com/profile/18089590556502179121</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/AVvXsEhVntswajx7anXbEyCWu2HujYN9Rg89mLgoRfjaxB3K-L9HFF-QkYj0UOy2EXj0H_1vXSmS86obvnxECy9bINdt5Lzo3PnAzIOdqGCOuDGN7-M9XxbwbCExzIwv8Cn8YOLqyuB36dqghYI/s72-c/exceptions.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3009465146130392037.post-2993385069905681654</id><published>2012-06-12T10:19:00.003-07:00</published><updated>2012-06-12T10:19:36.615-07:00</updated><title type='text'>Java I/O operations</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ocpjavacertifyme.blogspot.com/feeds/2993385069905681654/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ocpjavacertifyme.blogspot.com/2012/06/java-io-operations.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3009465146130392037/posts/default/2993385069905681654'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3009465146130392037/posts/default/2993385069905681654'/><link rel='alternate' type='text/html' href='http://ocpjavacertifyme.blogspot.com/2012/06/java-io-operations.html' title='Java I/O operations'/><author><name>Pintu</name><uri>http://www.blogger.com/profile/18089590556502179121</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-3009465146130392037.post-2147611527065856305</id><published>2012-06-12T10:19:00.001-07:00</published><updated>2012-06-12T10:19:15.181-07:00</updated><title type='text'>Working with RegularExpressions</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ocpjavacertifyme.blogspot.com/feeds/2147611527065856305/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ocpjavacertifyme.blogspot.com/2012/06/working-with-regularexpressions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3009465146130392037/posts/default/2147611527065856305'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3009465146130392037/posts/default/2147611527065856305'/><link rel='alternate' type='text/html' href='http://ocpjavacertifyme.blogspot.com/2012/06/working-with-regularexpressions.html' title='Working with RegularExpressions'/><author><name>Pintu</name><uri>http://www.blogger.com/profile/18089590556502179121</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-3009465146130392037.post-4573916556796310004</id><published>2012-06-12T10:18:00.001-07:00</published><updated>2012-06-12T10:18:46.515-07:00</updated><title type='text'>Working with Dates, Calanders and Formatting</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ocpjavacertifyme.blogspot.com/feeds/4573916556796310004/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ocpjavacertifyme.blogspot.com/2012/06/working-with-dates-calanders-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3009465146130392037/posts/default/4573916556796310004'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3009465146130392037/posts/default/4573916556796310004'/><link rel='alternate' type='text/html' href='http://ocpjavacertifyme.blogspot.com/2012/06/working-with-dates-calanders-and.html' title='Working with Dates, Calanders and Formatting'/><author><name>Pintu</name><uri>http://www.blogger.com/profile/18089590556502179121</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-3009465146130392037.post-8594860863858101807</id><published>2012-06-12T10:17:00.004-07:00</published><updated>2012-06-12T10:17:59.103-07:00</updated><title type='text'>Strings and String operations</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
coming soon&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ocpjavacertifyme.blogspot.com/feeds/8594860863858101807/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ocpjavacertifyme.blogspot.com/2012/06/strings-and-string-operations.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3009465146130392037/posts/default/8594860863858101807'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3009465146130392037/posts/default/8594860863858101807'/><link rel='alternate' type='text/html' href='http://ocpjavacertifyme.blogspot.com/2012/06/strings-and-string-operations.html' title='Strings and String operations'/><author><name>Pintu</name><uri>http://www.blogger.com/profile/18089590556502179121</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-3009465146130392037.post-4839000333910148589</id><published>2012-06-12T10:16:00.001-07:00</published><updated>2012-06-12T10:16:30.670-07:00</updated><title type='text'>Generics in Java</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ocpjavacertifyme.blogspot.com/feeds/4839000333910148589/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ocpjavacertifyme.blogspot.com/2012/06/generics-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3009465146130392037/posts/default/4839000333910148589'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3009465146130392037/posts/default/4839000333910148589'/><link rel='alternate' type='text/html' href='http://ocpjavacertifyme.blogspot.com/2012/06/generics-in-java.html' title='Generics in Java'/><author><name>Pintu</name><uri>http://www.blogger.com/profile/18089590556502179121</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-3009465146130392037.post-6277466989163689704</id><published>2012-06-12T10:15:00.005-07:00</published><updated>2012-06-12T10:15:56.278-07:00</updated><title type='text'>Oops Concepts</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ocpjavacertifyme.blogspot.com/feeds/6277466989163689704/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ocpjavacertifyme.blogspot.com/2012/06/oops-concepts.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3009465146130392037/posts/default/6277466989163689704'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3009465146130392037/posts/default/6277466989163689704'/><link rel='alternate' type='text/html' href='http://ocpjavacertifyme.blogspot.com/2012/06/oops-concepts.html' title='Oops Concepts'/><author><name>Pintu</name><uri>http://www.blogger.com/profile/18089590556502179121</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-3009465146130392037.post-4025640505684652518</id><published>2012-06-12T10:15:00.003-07:00</published><updated>2012-06-12T10:15:27.526-07:00</updated><title type='text'>Threads</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Coming soon&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ocpjavacertifyme.blogspot.com/feeds/4025640505684652518/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ocpjavacertifyme.blogspot.com/2012/06/threads.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3009465146130392037/posts/default/4025640505684652518'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3009465146130392037/posts/default/4025640505684652518'/><link rel='alternate' type='text/html' href='http://ocpjavacertifyme.blogspot.com/2012/06/threads.html' title='Threads'/><author><name>Pintu</name><uri>http://www.blogger.com/profile/18089590556502179121</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-3009465146130392037.post-2646333056947834557</id><published>2012-06-12T10:14:00.001-07:00</published><updated>2012-06-12T10:14:44.438-07:00</updated><title type='text'>Enums</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ocpjavacertifyme.blogspot.com/feeds/2646333056947834557/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ocpjavacertifyme.blogspot.com/2012/06/enums.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3009465146130392037/posts/default/2646333056947834557'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3009465146130392037/posts/default/2646333056947834557'/><link rel='alternate' type='text/html' href='http://ocpjavacertifyme.blogspot.com/2012/06/enums.html' title='Enums'/><author><name>Pintu</name><uri>http://www.blogger.com/profile/18089590556502179121</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-3009465146130392037.post-5150756176422227345</id><published>2012-06-11T08:16:00.000-07:00</published><updated>2012-06-12T22:40:33.512-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ArrayList"/><category scheme="http://www.blogger.com/atom/ns#" term="Collection"/><category scheme="http://www.blogger.com/atom/ns#" term="LinkedList"/><category scheme="http://www.blogger.com/atom/ns#" term="List"/><category scheme="http://www.blogger.com/atom/ns#" term="Set"/><title type='text'>Quick Tips on Collection</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b&gt;Collection Framework in Java&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8JCIQBwgewahwTrRGRsMqb1BYZmsinkNo2tUuSmhc4yrCTch52RHnALebC_34GbEwY-Aqkic13fflcPT4qsXUgnPoC0YdfJk_ir43o6VJAHHqauW79MllNQf3EjdSpWvfmgQLQGuQXYE/s1600/collections.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;315&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8JCIQBwgewahwTrRGRsMqb1BYZmsinkNo2tUuSmhc4yrCTch52RHnALebC_34GbEwY-Aqkic13fflcPT4qsXUgnPoC0YdfJk_ir43o6VJAHHqauW79MllNQf3EjdSpWvfmgQLQGuQXYE/s400/collections.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b&gt;&amp;nbsp;Important Interfaces&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Collection&amp;lt;E&amp;gt; -&lt;/b&gt; It is an interface. Provides basic structure for collection.&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;List&amp;lt;E&amp;gt;&lt;/b&gt; - An interface and an extension of Collection&amp;lt;E&amp;gt;. Provides index based collection. The element access is faster than any other collection. The collection is ordered. Duplicate elements allowed.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&amp;nbsp;Set&amp;lt;E&amp;gt; - &lt;/b&gt;An interface and an extension of Collection&amp;lt;E&amp;gt;. Unique elements&lt;b&gt; &lt;/b&gt;collection&lt;b&gt; &lt;/b&gt;that means duplicates not allowed. Object comparison is done through equals method. If two same objects are added to Set then first addition will return true and second addition will return false.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;SortedSet&amp;lt;E&amp;gt;&lt;/b&gt; - It extends the Set&amp;lt;E&amp;gt;. However, the elements will be sorted in objects natural order.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Queue&amp;lt;E&amp;gt;&lt;/b&gt; - Queue extends the Collection&amp;lt;E&amp;gt; and adds specific behaviors like First In First Out(FIFO) structure.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Map&amp;lt;K, V&amp;gt;&lt;/b&gt; - It does not implement Collection&amp;lt;E&amp;gt;. Map is another type of collection and it stores data in Key and Value pair. It uses the equals method internally to check the object equality. Key cannot be duplicate. Null Key is allowed but only one. Null values are allowed.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;SortedMap&amp;lt;K, V&amp;gt;&lt;/b&gt; - Extends Map and elements are kept in sorted order.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Iterator&amp;lt;E&amp;gt;&lt;/b&gt; -&amp;nbsp; An iterator over a collection. Iterators allow the caller to remove elements from the
      underlying collection during the iteration with well-defined
       semantics.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Important Classes which implements List&amp;lt;E&amp;gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;a. ArrayList&amp;lt;E&amp;gt;&lt;/b&gt; - Implements List&amp;lt;E&amp;gt;. Elements can be added and removed at the end. However, it is more expensive to add the elements in the middle. &lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Code : List&amp;lt;String&amp;gt; list = new ArrayList&amp;lt;String&amp;gt;();&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;or List&amp;lt;String&amp;gt; list = new ArrayList&amp;lt;String&amp;gt;(20);&amp;nbsp; - The constructor is taking int initialCapacity&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;or List&amp;lt;String&amp;gt; list = new ArrayList&amp;lt;String&amp;gt;(new ArrayList&amp;lt;String&amp;gt;);&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;// to add an element&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;list.add(&quot;test&quot;); &lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
The second example shows the List can be created by providing the initial capacity. This way a default size can be provided to the arraylist.&lt;br /&gt;
&lt;br /&gt;
The default capacity is 10. That means when the intial capacity is not provided then the ArrayList will have placeholder hold 10 elements which grows automatically when the capacity reaches its limit.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;b. LinkedList&amp;lt;E&amp;gt;&lt;/b&gt; - Implements List&amp;lt;E&amp;gt; and Deque&amp;lt;E&amp;gt;. The elements can be added at the start and at the end. The class implements the &lt;tt&gt;Deque&lt;/tt&gt; interface, providing
 first-in-first-out queue operations for &lt;tt&gt;add&lt;/tt&gt;,
 &lt;tt&gt;poll&lt;/tt&gt;, along with other stack and deque operations. In LinkedList the elements are doubly-linked to one another.&lt;br /&gt;
&lt;br /&gt;
The adding or removing elements at the end is same as ArrayList&amp;lt;E&amp;gt;. However, adding the elements in the middle is faster as it requires no copying.&amp;nbsp; The iteration is slower for LinkedList&amp;lt;E&amp;gt; than an ArrayList.&lt;br /&gt;
However, adding or deleting the elements could be faster than an Arraylist &lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Code : List&amp;lt;String&amp;gt; list = new LinkedList&amp;lt;String&amp;gt;();&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;or &lt;/i&gt;&lt;i&gt;List&amp;lt;String&amp;gt; list = new LinkedList&lt;/i&gt;&lt;i&gt;&amp;lt;String&amp;gt;(new ArrayList&amp;lt;String&amp;gt;);&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;//to add an element&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;list.addFirst(&quot;test&quot;);&amp;nbsp;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;list.addLast(&quot;test&quot;);&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;Other important methods are peek(); pole(); push(E e); offer(); etc.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Important: The LinkedList does not implement RandonAccessList&amp;lt;E&amp;gt; which is a marker interface for accessing the elements on index based searches. ArrayList&amp;lt;E&amp;gt; implements this interface and this helps for a faster access of the elements.&amp;nbsp;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;c. Vector&amp;lt;E&amp;gt;&lt;/b&gt;&lt;i&gt; - &lt;/i&gt;This class implements List and also RandomAccess. Thus index based search is faster. All methods in Vector are synchronised&amp;nbsp; thus performance of Vector is slower than the ArrayList.&lt;br /&gt;
Otherwise Vector provides the same methods as ArrayList.&lt;br /&gt;
&lt;br /&gt;
d. &lt;b&gt;Stack&amp;lt;E&amp;gt;&lt;/b&gt; - Extension of Vector. However, it maintains the Last In First Out data structure. It also implements RandonAccess interface. &lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Important Classes which implements Set&amp;lt;E&amp;gt; &lt;/b&gt;&lt;i&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;a. &lt;/i&gt;&lt;b&gt;HashSet&amp;lt;E&lt;/b&gt;&lt;i&gt;&amp;gt; - &lt;/i&gt;This class implements the &lt;tt&gt;Set&lt;/tt&gt; interface, backed by a hash table
 (actually a &lt;tt&gt;HashMap&lt;/tt&gt; instance).  It makes no guarantees as to the
 iteration order of the set; in particular, it does not guarantee that the
 order will remain constant over time.  This class permits the &lt;tt&gt;null&lt;/tt&gt;
 element.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Code: There 4 different ways a HashSet object can be created.&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;i&gt;Set&amp;lt;String&amp;gt; set&amp;nbsp; = new HashSet&amp;lt;String&amp;gt;() - Default constructor and the backing HashMap will have default initialCapacity as 16 and load factor as 0.75&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Set&amp;lt;String&amp;gt; set = new HashSet&amp;lt;String&amp;gt;(new List&amp;lt;String&amp;gt;());&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Set&amp;lt;String&amp;gt; set = new HashSet&amp;lt;String&amp;gt;(20, 1f) - Constructor taking the capacity as 20 and load factor as 1&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Set&amp;lt;String&amp;gt; set = new HashSet&amp;lt;String&amp;gt;(20) - Constructor taking the initialCapacity value as 20.&lt;/i&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;i&gt;Once a list is created the elements can be added by&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;set.add(&quot;test&quot;);&amp;nbsp;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;b&gt;Note:&lt;/b&gt; The add method or remove method returns false which is not the case with List. List will always return true as duplicates are allowed.&amp;nbsp;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
b&lt;i&gt;. &lt;/i&gt;&lt;b&gt;LinkedHashSet&amp;lt;E&amp;gt;&lt;/b&gt;&lt;i&gt; - &lt;/i&gt;Hash table and linked list implementation of the &lt;tt&gt;Set&lt;/tt&gt; interface,
 with predictable iteration order. Thus it is an advantage over HashSet which does not keep the elements in the insertion order. However, due to the LinkedList structure the performance of the LinkedHashSet is slower than the HashSet.&lt;br /&gt;
&lt;br /&gt;
Otherwise it does the same operations like the HashSet. Please refer the HashSet for constructor over views.&lt;br /&gt;
&lt;br /&gt;
c. &lt;b&gt;TreeSet&amp;lt;E&amp;gt;&lt;/b&gt; - It implements SortedSet&amp;lt;E&amp;gt;. Internally unlike HashSet which uses the HashMap for storing the elements, this uses TreeMap&amp;lt;E&amp;gt; or an implementation of NavigableMap&amp;lt;E&amp;gt;.&lt;br /&gt;
The objects are sorted by the natural order using an underlying comparator. The comparator can also be provided using the constructor which is used for sorting the objects based on some order.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;Important Classes which implements Map&amp;lt;E&amp;gt;&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;a. HashMap&amp;lt;E&amp;gt;&lt;/b&gt; - Provides to store elements in an unordered and unsorted way similar to HashSet structure. The keys are maintained as per the Hashtable value. HashMap does allow a null key. Values can be null many times. &lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;HashMap can be created by the following ways&amp;nbsp;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;1. Map&amp;lt;String, String&amp;gt; map = new HashMap&amp;lt;String, String&amp;gt;();&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;2. Map&amp;lt;String, String&amp;gt; map = new HashMap&amp;lt;String, String&amp;gt;(10, 1f); - Takes the initial capacity and load factor&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;3. Map&amp;lt;String, String&amp;gt; map = new HashMap&amp;lt;String, String&amp;gt;(10); - Takes the intial capacity and uses default load factor.&lt;/i&gt; &lt;br /&gt;
&lt;i&gt;4. Map&amp;lt;String, String&amp;gt; map = new HashMap&amp;lt;String, String&amp;gt;(new HashMap&amp;lt;String, String&amp;gt;); - Takes already present collection. Internally uses addAll method to add everything to the new Map&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
b.&lt;b&gt; Hashtable&amp;lt;E&amp;gt;&lt;/b&gt; - Hashtable is a synchronised version of the HashMap i.e. critical methods are synchronised. Hashtable does not allow anything that is null whether it is a key or a value.&lt;br /&gt;
&lt;br /&gt;
c. &lt;b&gt;TreeMap&amp;lt;E&amp;gt;&lt;/b&gt; - TreeMap&amp;lt;E&amp;gt; implements NavigableMap. The elements kept in this map are sorted as per the keys using the comaprator either provided externally or using inbuilt comparators.&lt;br /&gt;
&lt;br /&gt;
Note that the ordering maintained by a sorted map (whether or not an
 explicit comparator is provided) must be &lt;i&gt;consistent with equals&lt;/i&gt; if
 this sorted map is to correctly implement the &lt;tt&gt;Map&lt;/tt&gt; interface.  (See
 &lt;tt&gt;Comparable&lt;/tt&gt; or &lt;tt&gt;Comparator&lt;/tt&gt; for a precise definition of
 &lt;i&gt;consistent with equals&lt;/i&gt;.)  This is so because the &lt;tt&gt;Map&lt;/tt&gt;
 interface is defined in terms of the equals operation, but a map performs
 all key comparisons using its &lt;tt&gt;compareTo&lt;/tt&gt; (or &lt;tt&gt;compare&lt;/tt&gt;)
 method, so two keys that are deemed equal by this method are, from the
 standpoint of the sorted map, equal.  The behavior of a sorted map
 &lt;i&gt;is&lt;/i&gt; well-defined even if its ordering is inconsistent with equals; it
 just fails to obey the general contract of the &lt;tt&gt;Map&lt;/tt&gt; interface.&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
d. &lt;b&gt;LinkedHashMap&amp;lt;E&amp;gt;&lt;/b&gt; - The structure is same as a HashMap however the elements are doubly linked with each other. Iteration through the elements will thus slower than a HashMap.&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;&lt;i&gt;&lt;b&gt;LinkedHashMap provides a additional constructor for passing the accessorder as a boolean value. If true then elements will be retrived as per the insertion order.&lt;/b&gt;&lt;/i&gt;&lt;/code&gt;

&lt;br /&gt;
&lt;br /&gt;
e. WeakHashMap&amp;lt;E&amp;gt; - //TO DO&lt;br /&gt;
&lt;i&gt; &lt;/i&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ocpjavacertifyme.blogspot.com/feeds/5150756176422227345/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ocpjavacertifyme.blogspot.com/2012/06/quick-tips-on-collection.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3009465146130392037/posts/default/5150756176422227345'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3009465146130392037/posts/default/5150756176422227345'/><link rel='alternate' type='text/html' href='http://ocpjavacertifyme.blogspot.com/2012/06/quick-tips-on-collection.html' title='Quick Tips on Collection'/><author><name>Pintu</name><uri>http://www.blogger.com/profile/18089590556502179121</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/AVvXsEh8JCIQBwgewahwTrRGRsMqb1BYZmsinkNo2tUuSmhc4yrCTch52RHnALebC_34GbEwY-Aqkic13fflcPT4qsXUgnPoC0YdfJk_ir43o6VJAHHqauW79MllNQf3EjdSpWvfmgQLQGuQXYE/s72-c/collections.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3009465146130392037.post-8839219685016406676</id><published>2012-06-10T20:11:00.001-07:00</published><updated>2012-06-10T20:13:35.337-07:00</updated><title type='text'>OCP Java 1.6</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
The SCJP certification has changed its name to OCP Java 1.6 Programmer. The details of this exam can be found at http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=41&amp;amp;p_exam_id=1Z0_851&lt;br /&gt;
&lt;br /&gt;
The exam opens roads for all the other Java certifications like SCWCD or SCEA. The exam is not that difficult however there can be some questions which are little tricky and at times confusing.&lt;br /&gt;
&lt;br /&gt;
I&#39;ll try and cover practice notes for all the chapters.&lt;br /&gt;
&lt;br /&gt;
The following objectives we will discuss. There will small noted and objective examples which will help to crack the exam quickly.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;padding: 10px;&quot;&gt;

&lt;strong&gt;Section 1: Declarations, Initialization and Scoping &lt;/strong&gt;&lt;hr color=&quot;#999999&quot; size=&quot;1&quot; style=&quot;height: 1px;&quot; /&gt;
&lt;ul&gt;
&lt;li&gt;Develop code that declares classes (including abstract and all forms
 of nested classes), interfaces, and enums, and includes the appropriate
 use of package and import statements (including static imports). &lt;/li&gt;
&lt;li&gt;Develop code that declares an interface. Develop code that 
implements or extends one or more interfaces. Develop code that declares
 an abstract class. Develop code that extends an abstract class. &lt;/li&gt;
&lt;li&gt;Develop code that declares, initializes, and uses primitives, 
arrays, enums, and objects as static, instance, and local variables. 
Also, use legal identifiers for variable names. &lt;/li&gt;
&lt;li&gt;Given a code example, determine if a method is correctly overriding 
or overloading another method, and identify legal return values 
(including covariant returns), for the method. &lt;/li&gt;
&lt;li&gt;Given a set of classes and superclasses, develop constructors for 
one or more of the classes. Given a class declaration, determine if a 
default constructor will be created, and if so, determine the behavior 
of that constructor. Given a nested or non-nested class listing, write 
code to instantiate the class. &lt;/li&gt;
&lt;/ul&gt;
&lt;strong&gt;Section 2: Flow Control &lt;/strong&gt;&lt;hr color=&quot;#999999&quot; size=&quot;1&quot; style=&quot;height: 1px;&quot; /&gt;
&lt;ul&gt;
&lt;li&gt;Develop code that implements an if or switch statement; and identify legal argument types for these statements. &lt;/li&gt;
&lt;li&gt;Develop code that implements all forms of loops and iterators, 
including the use of for, the enhanced for loop (for-each), do, while, 
labels, break, and continue; and explain the values taken by loop 
counter variables during and after loop execution. &lt;/li&gt;
&lt;li&gt;Develop code that makes use of assertions, and distinguish appropriate from inappropriate uses of assertions. &lt;/li&gt;
&lt;li&gt;Develop code that makes use of exceptions and exception handling 
clauses (try, catch, finally), and declares methods and overriding 
methods that throw exceptions. &lt;/li&gt;
&lt;li&gt;Recognize the effect of an exception arising at a specified point in
 a code fragment. Note that the exception may be a runtime exception, a 
checked exception, or an error. &lt;/li&gt;
&lt;li&gt;Recognize situations that will result in any of the following being 
thrown: ArrayIndexOutOfBoundsException,ClassCastException, 
IllegalArgumentException, IllegalStateException, NullPointerException, 
NumberFormatException, AssertionError, ExceptionInInitializerError, 
StackOverflowError or NoClassDefFoundError. Understand which of these 
are thrown by the virtual machine and recognize situations in which 
others should be thrown programatically. &lt;/li&gt;
&lt;/ul&gt;
&lt;strong&gt;Section 3: API Contents &lt;/strong&gt;&lt;hr color=&quot;#999999&quot; size=&quot;1&quot; style=&quot;height: 1px;&quot; /&gt;
&lt;ul&gt;
&lt;li&gt;Develop code that uses the primitive wrapper classes (such as 
Boolean, Character, Double, Integer, etc.), and/or autoboxing &amp;amp; 
unboxing. Discuss the differences between the String, StringBuilder, and
 StringBuffer classes. &lt;/li&gt;
&lt;li&gt;Given a scenario involving navigating file systems, reading from 
files, writing to files, or interacting with the user, develop the 
correct solution using the following classes (sometimes in combination),
 from java.io: BufferedReader, BufferedWriter, File, FileReader, 
FileWriter, PrintWriter, and Console. &lt;/li&gt;
&lt;li&gt;Use standard J2SE APIs in the java.text package to correctly format 
or parse dates, numbers, and currency values for a specific locale; and,
 given a scenario, determine the appropriate methods to use if you want 
to use the default locale or a specific locale. Describe the purpose and
 use of the java.util.Locale class. &lt;/li&gt;
&lt;li&gt;Write code that uses standard J2SE APIs in the java.util and 
java.util.regex packages to format or parse strings or streams. For 
strings, write code that uses the Pattern and Matcher classes and the 
String.split method. Recognize and use regular expression patterns for 
matching (limited to: . (dot), * (star), + (plus), ?, \d, \s, \w, [], 
()). The use of *, +, and ? will be limited to greedy quantifiers, and 
the parenthesis operator will only be used as a grouping mechanism, not 
for capturing content during matching. For streams, write code using the
 Formatter and Scanner classes and the PrintWriter.format/printf 
methods. Recognize and use formatting parameters (limited to: %b, %c, 
%d, %f, %s) in format strings. &lt;/li&gt;
&lt;/ul&gt;
&lt;strong&gt;Section 4: Concurrency &lt;/strong&gt;&lt;hr color=&quot;#999999&quot; size=&quot;1&quot; style=&quot;height: 1px;&quot; /&gt;
&lt;ul&gt;
&lt;li&gt;Write code to define, instantiate, and start new threads using both java.lang.Thread and java.lang.Runnable. &lt;/li&gt;
&lt;li&gt;Recognize the states in which a thread can exist, and identify ways in which a thread can transition from one state to another. &lt;/li&gt;
&lt;li&gt;Given a scenario, write code that makes appropriate use of object 
locking to protect static or instance variables from concurrent access 
problems. &lt;/li&gt;
&lt;/ul&gt;
&lt;strong&gt;Section 5: OO Concepts &lt;/strong&gt;&lt;hr color=&quot;#999999&quot; size=&quot;1&quot; style=&quot;height: 1px;&quot; /&gt;
&lt;ul&gt;
&lt;li&gt;Develop code that implements tight encapsulation, loose coupling, and high cohesion in classes, and describe the benefits. &lt;/li&gt;
&lt;li&gt;Given a scenario, develop code that demonstrates the use of 
polymorphism. Further, determine when casting will be necessary and 
recognize compiler vs. runtime errors related to object reference 
casting. &lt;/li&gt;
&lt;li&gt;Explain the effect of modifiers on inheritance with respect to 
constructors, instance or static variables, and instance or static 
methods. &lt;/li&gt;
&lt;li&gt;Given a scenario, develop code that declares and/or invokes 
overridden or overloaded methods and code that declares and/or invokes 
superclass, or overloaded constructors. &lt;/li&gt;
&lt;li&gt;Develop code that implements &quot;is-a&quot; and/or &quot;has-a&quot; relationships. &lt;/li&gt;
&lt;/ul&gt;
&lt;strong&gt;Section 6: Collections / Generics &lt;/strong&gt;&lt;hr color=&quot;#999999&quot; size=&quot;1&quot; style=&quot;height: 1px;&quot; /&gt;
&lt;ul&gt;
&lt;li&gt;Given a design scenario, determine which collection classes and/or 
interfaces should be used to properly implement that design, including 
the use of the Comparable interface. &lt;/li&gt;
&lt;li&gt;Distinguish between correct and incorrect overrides of corresponding
 hashCode and equals methods, and explain the difference between == and 
the equals method. &lt;/li&gt;
&lt;li&gt;Write code that uses the generic versions of the Collections API, in
 particular, the Set, List, and Map interfaces and implementation 
classes. Recognize the limitations of the non-generic Collections API 
and how to refactor code to use the generic versions. Write code that 
uses the NavigableSet and NavigableMap interfaces. &lt;/li&gt;
&lt;li&gt;Develop code that makes proper use of type parameters in 
class/interface declarations, instance variables, method arguments, and 
return types; and write generic methods or methods that make use of 
wildcard types and understand the similarities and differences between 
these two approaches. &lt;/li&gt;
&lt;li&gt;Use capabilities in the java.util package to write code to 
manipulate a list by sorting, performing a binary search, or converting 
the list to an array. Use capabilities in the java.util package to write
 code to manipulate an array by sorting, performing a binary search, or 
converting the array to a list. Use the java.util.Comparator and 
java.lang.Comparable interfaces to affect the sorting of lists and 
arrays. Furthermore, recognize the effect of the &quot;natural ordering&quot; of 
primitive wrapper classes and java.lang.String on sorting. &lt;/li&gt;
&lt;/ul&gt;
&lt;strong&gt;Section 7: Fundamentals &lt;/strong&gt;&lt;hr color=&quot;#999999&quot; size=&quot;1&quot; style=&quot;height: 1px;&quot; /&gt;
&lt;ul&gt;
&lt;li&gt;Given a code example and a scenario, write code that uses the 
appropriate access modifiers, package declarations, and import 
statements to interact with (through access or inheritance) the code in 
the example. &lt;/li&gt;
&lt;li&gt;Given an example of a class and a command-line, determine the expected runtime behavior. &lt;/li&gt;
&lt;li&gt;Determine the effect upon object references and primitive values 
when they are passed into methods that perform assignments or other 
modifying operations on the parameters. &lt;/li&gt;
&lt;li&gt;Given a code example, recognize the point at which an object becomes
 eligible for garbage collection, determine what is and is not 
guaranteed by the garbage collection system, and recognize the behaviors
 of the Object.finalize() method. &lt;/li&gt;
&lt;li&gt;Given the fully-qualified name of a class that is deployed inside 
and/or outside a JAR file, construct the appropriate directory structure
 for that class. Given a code example and a classpath, determine whether
 the classpath will allow the code to compile successfully. &lt;/li&gt;
&lt;li&gt;Write code that correctly applies the appropriate operators 
including assignment operators (limited to: =, +=, -=), arithmetic 
operators (limited to: +, -, *, /, %, ++, --), relational operators 
(limited to: &amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=, ==, !=), the instanceof operator,
 logical operators (limited to: &amp;amp;, |, ^, !, &amp;amp;&amp;amp;, ||), and the
 conditional operator ( ? : ), to produce a desired result. Write code 
that determines the equality of two objects or two primitives. &lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ocpjavacertifyme.blogspot.com/feeds/8839219685016406676/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ocpjavacertifyme.blogspot.com/2012/06/ocp-java-16.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3009465146130392037/posts/default/8839219685016406676'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3009465146130392037/posts/default/8839219685016406676'/><link rel='alternate' type='text/html' href='http://ocpjavacertifyme.blogspot.com/2012/06/ocp-java-16.html' title='OCP Java 1.6'/><author><name>Pintu</name><uri>http://www.blogger.com/profile/18089590556502179121</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-3009465146130392037.post-4212929859290326899</id><published>2012-06-10T10:57:00.002-07:00</published><updated>2012-06-10T10:57:38.263-07:00</updated><title type='text'></title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Everyday I am going to post Java 1.6 certification notes. This will surely help to clearly clear the certification exam on one go..&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ocpjavacertifyme.blogspot.com/feeds/4212929859290326899/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ocpjavacertifyme.blogspot.com/2012/06/everyday-i-am-going-to-post-java-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3009465146130392037/posts/default/4212929859290326899'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3009465146130392037/posts/default/4212929859290326899'/><link rel='alternate' type='text/html' href='http://ocpjavacertifyme.blogspot.com/2012/06/everyday-i-am-going-to-post-java-1.html' title=''/><author><name>Pintu</name><uri>http://www.blogger.com/profile/18089590556502179121</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>