<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" gd:etag="W/&quot;AkUBQ384eip7ImA9WhRUGU0.&quot;"><id>tag:blogger.com,1999:blog-2056945240977755077</id><updated>2012-01-30T12:54:12.132+05:30</updated><category term="mobile" /><category term="make" /><category term="Help" /><category term="DUMPS" /><category term="JAVA" /><category term="solved" /><category term="tutorial" /><category term="mock" /><category term="LINK" /><category term="SCJP" /><category term="Tips" /><category term="questions" /><category term="TRICKS" /><category term="Test" /><category term="money" /><category term="notes" /><title>JAVA CRACKERS</title><subtitle type="html">It is a blog related to java programming language
It contains FAQ's,videos and tutorials related to java</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://javacrackers.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://javacrackers.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>gautam</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://4.bp.blogspot.com/_ACUdDpwsnW0/Sl6zJQlW8kI/AAAAAAAAAoA/d9Gu11zRf0w/s1600-R/ls_0724_twitte-gatam.JPG" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>68</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/blogspot/nQxR" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="blogspot/nqxr" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">blogspot/nQxR</feedburner:emailServiceId><feedburner:feedburnerHostname xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://feedburner.google.com</feedburner:feedburnerHostname><entry gd:etag="W/&quot;AkEDQHg_fCp7ImA9WxJTEk4.&quot;"><id>tag:blogger.com,1999:blog-2056945240977755077.post-8336525181846671948</id><published>2009-04-20T19:41:00.006+05:30</published><updated>2009-04-20T20:14:31.644+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-04-20T20:14:31.644+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SCJP" /><category scheme="http://www.blogger.com/atom/ns#" term="notes" /><category scheme="http://www.blogger.com/atom/ns#" term="Tips" /><category scheme="http://www.blogger.com/atom/ns#" term="DUMPS" /><category scheme="http://www.blogger.com/atom/ns#" term="tutorial" /><category scheme="http://www.blogger.com/atom/ns#" term="TRICKS" /><category scheme="http://www.blogger.com/atom/ns#" term="Help" /><category scheme="http://www.blogger.com/atom/ns#" term="JAVA" /><title>JAVA@COFFEE</title><content type="html">&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://tbn2.google.com/images?q=tbn:VXdSUwaN1anVAM:http://blogs.sun.com/theplanetarium/resource/t_java_logo.jpg"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 116px; height: 116px;" src="http://tbn2.google.com/images?q=tbn:VXdSUwaN1anVAM:http://blogs.sun.com/theplanetarium/resource/t_java_logo.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;JAVA TUTORIALS &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul class="posts"&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/12/arrays-i.html"&gt;ARRAYS  - I&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/12/arrays-ii.html"&gt;ARRAYS - II&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/12/java-video-tutorials.html"&gt;Java Video Tutorials&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/12/casting.html"&gt;CASTING&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/12/casting-ii.html"&gt;CASTING - II&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/07/how-to-create-javapath.html"&gt;How To Create Javapath&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/11/modifiers.html"&gt;MODIFIERS&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/11/modifiers-2.html"&gt;MODIFIERS 2&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/07/util-package-q1-what-is-collections-api.html"&gt;Util Package   Q1: What is the Collections API?&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/11/overloading.html"&gt;OVERLOADING&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/11/overriding.html"&gt;OVERRIDING&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/11/constructors-and-subclassing.html"&gt;CONSTRUCTORS AND SUBCLASSING&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/11/overloading-constructors-1.html"&gt;OVERLOADING CONSTRUCTORS 1&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/11/overloading-constructors-2.html"&gt;OVERLOADING CONSTRUCTORS 2&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/11/inner-classes.html"&gt;INNER CLASSES&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/11/anonymous-classes.html"&gt;ANONYMOUS CLASSES&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;JAVA DUMPS&lt;/span&gt;&lt;ul class="posts"&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/11/java-dumps-1scjp.html"&gt;JAVA DUMPS 1(SCJP)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/11/java-dumps-2scjp.html"&gt;JAVA DUMPS 2(SCJP)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/11/java-dumps-3scjp.html"&gt;JAVA DUMPS 3(SCJP)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/11/java-dumps-4scjp.html"&gt;JAVA DUMPS 4(SCJP)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/11/scjp-dumps-5scjp.html"&gt;JAVA DUMPS 5(SCJP)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/11/java-dumps-5scjp.html"&gt;JAVA DUMPS 6(SCJP)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/11/java-dumps-7scjp.html"&gt;JAVA DUMPS 7(SCJP)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/11/java-dumps-8scjp.html"&gt;JAVA DUMPS 8(SCJP)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/11/java-dumps-9scjp.html"&gt;JAVA DUMPS 9(SCJP)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/11/java-dumps-10scjp.html"&gt;JAVA DUMPS 10(SCJP)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/11/java-dumps-11scjp.html"&gt;JAVA DUMPS 11(SCJP)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/11/java-dumps-12scjp.html"&gt;JAVA DUMPS 12(SCJP)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/12/java-dumps-13scjp.html"&gt;JAVA DUMPS 13(SCJP)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/12/java-dumps-14-scjp.html"&gt;JAVA DUMPS 14 (SCJP)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/12/java-dumps-15-scjp.html"&gt;JAVA DUMPS 15 (SCJP)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/12/java-dumps-16-scjp.html"&gt;JAVA DUMPS 16 (SCJP)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/12/java-dumps-17-scjp.html"&gt;JAVA DUMPS 17 (SCJP)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/12/java-dumps-18-scjp.html"&gt;JAVA  DUMPS 18 (SCJP)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/12/java-dumps-19-scjp.html"&gt;JAVA DUMPS 19 (SCJP)&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;TIPS&lt;br /&gt;&lt;/span&gt;&lt;ul class="posts"&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2009/02/tips-to-crack-scjp_11.html"&gt;TIPS TO CRACK SCJP&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/07/what-is-new-in-exam-for-scjp-15.html"&gt;What is new in exam for SCJP 1.5&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/07/objectives-of-scjp.html"&gt;Objectives of SCJP&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/07/format-of-paper.html"&gt;format of the paper&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://javacrackers.blogspot.com/2007/07/points-to-remember.html"&gt;Points to Remember&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2056945240977755077-8336525181846671948?l=javacrackers.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/B4gaC5AcSyvhK7w0CIc2Va9J4Do/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/B4gaC5AcSyvhK7w0CIc2Va9J4Do/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/B4gaC5AcSyvhK7w0CIc2Va9J4Do/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/B4gaC5AcSyvhK7w0CIc2Va9J4Do/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/blogspot/nQxR?a=uHdD2eSZcQw:hGb-v235u28:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/blogspot/nQxR?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://javacrackers.blogspot.com/feeds/8336525181846671948/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://javacrackers.blogspot.com/2009/04/javacoffee.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/8336525181846671948?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/8336525181846671948?v=2" /><link rel="alternate" type="text/html" href="http://javacrackers.blogspot.com/2009/04/javacoffee.html" title="JAVA@COFFEE" /><author><name>gautam</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://4.bp.blogspot.com/_ACUdDpwsnW0/Sl6zJQlW8kI/AAAAAAAAAoA/d9Gu11zRf0w/s1600-R/ls_0724_twitte-gatam.JPG" /></author><thr:total>3</thr:total></entry><entry gd:etag="W/&quot;DkAMRn8yeyp7ImA9WxVVFUw.&quot;"><id>tag:blogger.com,1999:blog-2056945240977755077.post-3336834259539464060</id><published>2009-02-11T00:58:00.002+05:30</published><updated>2009-03-08T17:49:47.193+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-03-08T17:49:47.193+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SCJP" /><category scheme="http://www.blogger.com/atom/ns#" term="Test" /><category scheme="http://www.blogger.com/atom/ns#" term="Tips" /><category scheme="http://www.blogger.com/atom/ns#" term="TRICKS" /><category scheme="http://www.blogger.com/atom/ns#" term="JAVA" /><title>TIPS TO CRACK SCJP</title><content type="html">&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;1. THE BOOK: &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;The best reference for SCJP is &lt;a href="http://www.amazon.com/gp/product/0596009208?ie=UTF8&amp;amp;tag=whackwhizz-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=0596009208"&gt;Head First Java, 2nd Edition&lt;/a&gt;&lt;img src="http://www.assoc-amazon.com/e/ir?t=whackwhizz-20&amp;amp;l=as2&amp;amp;o=1&amp;amp;a=0596009208" alt="" style="border: medium none  ! important; margin: 0px ! important;" border="0" width="1" height="1" /&gt;.&lt;br /&gt;This books gives all the inside and out of java which is required for SCJP examination.&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;img src="http://gautamhansroaring.googlepages.com/warning_48.png" alt="Caution" align="top"&gt;&lt;br /&gt;Herbert Schildt is a good book in general, but is not a good reference for SCJP and many of the texts in this book are not correct.&lt;br /&gt;So in my opinion &lt;a href="http://www.amazon.com/gp/product/0596009208?ie=UTF8&amp;amp;tag=whackwhizz-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=0596009208"&gt;Head First Java, 2nd Edition&lt;/a&gt;&lt;img src="http://www.assoc-amazon.com/e/ir?t=whackwhizz-20&amp;amp;l=as2&amp;amp;o=1&amp;amp;a=0596009208" alt="" style="border: medium none  ! important; margin: 0px ! important;" border="0" width="1" height="1" /&gt; is the Bible for SCJP.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;2. SCJP DUMPS&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;SCJP Dumps are set of mock and previous year papers. Previous year questions are a must.&lt;br /&gt;If one understands and masters all the questions, one can easily score in the range of 75 -100%.&lt;br /&gt;These questions often get repeated and if one goes through the whole set, one is bound to get around 60-80% questions in the test from previous year papers.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;3.TEST &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;First of all, make sure that you mark 'novice' in the survey taken by sun prior to the test(SCJP).&lt;br /&gt;Don't ever mark 'intermediate' or 'expert' because the paper will become quite difficult and might be difficult to pass even.&lt;br /&gt;&lt;br /&gt;Secondly, 'Drag and Drop Questions'- these questions have to be attempted very carefully.&lt;br /&gt;Make sure you check before confirming your answer because after confirming if you try to check your answer,it gets refreshed, and your answers disappear.&lt;br /&gt;So better technique is to try and check in the first attempt itself.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2056945240977755077-3336834259539464060?l=javacrackers.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/QQ8yF8SdpUIP4A-7RKeMSx0LNf0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/QQ8yF8SdpUIP4A-7RKeMSx0LNf0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/QQ8yF8SdpUIP4A-7RKeMSx0LNf0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/QQ8yF8SdpUIP4A-7RKeMSx0LNf0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/blogspot/nQxR?a=8hojhOdqSHY:Z-nKCNmiIiM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/blogspot/nQxR?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://javacrackers.blogspot.com/feeds/3336834259539464060/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://javacrackers.blogspot.com/2009/02/tips-to-crack-scjp_11.html#comment-form" title="66 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/3336834259539464060?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/3336834259539464060?v=2" /><link rel="alternate" type="text/html" href="http://javacrackers.blogspot.com/2009/02/tips-to-crack-scjp_11.html" title="TIPS TO CRACK SCJP" /><author><name>gautam</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://4.bp.blogspot.com/_ACUdDpwsnW0/Sl6zJQlW8kI/AAAAAAAAAoA/d9Gu11zRf0w/s1600-R/ls_0724_twitte-gatam.JPG" /></author><thr:total>66</thr:total></entry><entry gd:etag="W/&quot;CkcCRHo9cCp7ImA9WB9aEUU.&quot;"><id>tag:blogger.com,1999:blog-2056945240977755077.post-9212734790266009209</id><published>2007-12-31T15:34:00.000+05:30</published><updated>2008-01-01T15:04:25.468+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-01-01T15:04:25.468+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SCJP" /><category scheme="http://www.blogger.com/atom/ns#" term="mock" /><category scheme="http://www.blogger.com/atom/ns#" term="solved" /><category scheme="http://www.blogger.com/atom/ns#" term="questions" /><category scheme="http://www.blogger.com/atom/ns#" term="JAVA" /><title>SCJP MOCK QUESTIONS - 2</title><content type="html">&lt;span style="FONT-WEIGHT: bold"&gt;Question 2&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;Given:&lt;br /&gt;10. public class Bar {&lt;br /&gt;11.static void foo(int...x) {&lt;br /&gt;12. // insert code here&lt;br /&gt;13. }&lt;br /&gt;14. }&lt;br /&gt;Which two code fragments, inserted independently at line 12, will allow&lt;br /&gt;the class to compile? (Choose two.)&lt;br /&gt;A. foreach(x) System.out.println(z);&lt;br /&gt;B. for(int z : x) System.out.println(z);&lt;br /&gt;C. while( x.hasNext()) System.out.println( x.next());&lt;br /&gt;D. for( int i=0; i&lt; x.length; i++ ) System.out.println(x[i]);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Answer: BD&lt;br /&gt;&lt;br /&gt;Answer:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;type... x is used in function arguments where type can be any data type&lt;br /&gt;for example:&lt;br /&gt;int... x&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;which can take variable arguments&lt;br /&gt;for example a function named var having declarations&lt;br /&gt;&lt;br /&gt;var(int... x)&lt;br /&gt;&lt;br /&gt;we can pass var(1); , var(1,1); , var(1,2,3);&lt;br /&gt;&lt;br /&gt;so it can take 1 to any number of integers as arguments&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;int... x here x is just like an array and we can iterate over its elements using simple and enhanced for loop&lt;br /&gt;&lt;br /&gt;other options are invalid&lt;br /&gt;&lt;br /&gt;foreach is a method which is not defined&lt;br /&gt;And hasnext() is used to iterate over collections(sets,lists,maps)&lt;br /&gt;&lt;br /&gt;Hence the answer is B,D&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2056945240977755077-9212734790266009209?l=javacrackers.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/CqMhNN_qCT9RojL-NHMUYiqverA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/CqMhNN_qCT9RojL-NHMUYiqverA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/CqMhNN_qCT9RojL-NHMUYiqverA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/CqMhNN_qCT9RojL-NHMUYiqverA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/blogspot/nQxR?a=SUlDnAsqKnM:E76SV10s-X0:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/blogspot/nQxR?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://javacrackers.blogspot.com/feeds/9212734790266009209/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://javacrackers.blogspot.com/2007/12/scjp-mock-questions-2.html#comment-form" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/9212734790266009209?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/9212734790266009209?v=2" /><link rel="alternate" type="text/html" href="http://javacrackers.blogspot.com/2007/12/scjp-mock-questions-2.html" title="SCJP MOCK QUESTIONS - 2" /><author><name>gautam</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://4.bp.blogspot.com/_ACUdDpwsnW0/Sl6zJQlW8kI/AAAAAAAAAoA/d9Gu11zRf0w/s1600-R/ls_0724_twitte-gatam.JPG" /></author><thr:total>4</thr:total></entry><entry gd:etag="W/&quot;C04HRX0-fyp7ImA9WB9bGUQ.&quot;"><id>tag:blogger.com,1999:blog-2056945240977755077.post-8425357121444693658</id><published>2007-12-30T10:14:00.000+05:30</published><updated>2007-12-30T10:48:54.357+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-12-30T10:48:54.357+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SCJP" /><category scheme="http://www.blogger.com/atom/ns#" term="mock" /><category scheme="http://www.blogger.com/atom/ns#" term="solved" /><category scheme="http://www.blogger.com/atom/ns#" term="questions" /><category scheme="http://www.blogger.com/atom/ns#" term="JAVA" /><title>SCJP MOCK QUESTIONS - 1</title><content type="html">&lt;span style="font-weight: bold;"&gt;QUESTION&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Given:&lt;br /&gt;11. public interface Status {&lt;br /&gt;12. /* insert code here */ int MY_TRUE_VALUE = 10;&lt;br /&gt;13. }&lt;br /&gt;Which three are valid on line 12? (Choose three.)&lt;br /&gt;A. final&lt;br /&gt;B. static&lt;br /&gt;C. native&lt;br /&gt;D. public&lt;br /&gt;E. private&lt;br /&gt;F. abstract&lt;br /&gt;G. protected&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;ANS &lt;/span&gt;- ABD&lt;br /&gt;&lt;br /&gt;In Interfaces we can define constants for example:&lt;br /&gt;&lt;br /&gt;interface you&lt;br /&gt;{    int i=10;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;now in interfaces every variable is implicitly public static final&lt;br /&gt;Therefore, though we define int i=10 but for the compiler it is&lt;br /&gt;public static final int i=10;&lt;br /&gt;&lt;br /&gt;Now you can even define  like this way :&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;final int i=10;&lt;/li&gt;&lt;li&gt;static int i=10;&lt;/li&gt;&lt;li&gt;public int i=10;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;public static int i=10;&lt;/li&gt;&lt;li&gt;public final int i=10;&lt;/li&gt;&lt;li&gt;static final int i=10;&lt;/li&gt;&lt;li&gt;public static final int i=10;&lt;/li&gt;&lt;/ol&gt;All these declarations are valid but for the compiler all these declarartions lead to the same declaration - public static final int i=10;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Invalid Declarations:&lt;br /&gt;&lt;br /&gt;native - can be only applied to methods&lt;br /&gt;private - variables in interfaces are public&lt;br /&gt;protected - variables in interfaces are public&lt;br /&gt;abstract - As the variables are implicitly final and we know final and abstract cannot be together, therefore it is invalid.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2056945240977755077-8425357121444693658?l=javacrackers.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Babi-M7GoLXm3H25JRyVfSpbFoA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Babi-M7GoLXm3H25JRyVfSpbFoA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Babi-M7GoLXm3H25JRyVfSpbFoA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Babi-M7GoLXm3H25JRyVfSpbFoA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/blogspot/nQxR?a=oiYb6Y-iTig:aqrJe4vdvOk:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/blogspot/nQxR?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://javacrackers.blogspot.com/feeds/8425357121444693658/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://javacrackers.blogspot.com/2007/12/scjp-mock-questions-1.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/8425357121444693658?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/8425357121444693658?v=2" /><link rel="alternate" type="text/html" href="http://javacrackers.blogspot.com/2007/12/scjp-mock-questions-1.html" title="SCJP MOCK QUESTIONS - 1" /><author><name>gautam</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://4.bp.blogspot.com/_ACUdDpwsnW0/Sl6zJQlW8kI/AAAAAAAAAoA/d9Gu11zRf0w/s1600-R/ls_0724_twitte-gatam.JPG" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;C0YDSHY_fCp7ImA9WB9bFUs.&quot;"><id>tag:blogger.com,1999:blog-2056945240977755077.post-7045924240911943903</id><published>2007-12-25T10:56:00.000+05:30</published><updated>2007-12-25T11:09:39.844+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-12-25T11:09:39.844+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="tutorial" /><category scheme="http://www.blogger.com/atom/ns#" term="JAVA" /><title>CASTING - II</title><content type="html">&lt;BR&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Casting to (byte)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Within the range:&lt;br /&gt;&lt;br /&gt;A byte is signed and can hold a range of numbers from -128 to 127. If the value of the widest type is within this range, conversion won't produce unexpected results.&lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;&lt;br /&gt;      int a = -128;&lt;br /&gt;&lt;br /&gt;      byte x = (byte)a; &lt;br /&gt;&lt;br /&gt;      float a = -128.0f;&lt;br /&gt;&lt;br /&gt;      byte x = (byte)a; &lt;br /&gt;&lt;br /&gt;      Result in both cases: -128&lt;br /&gt;&lt;br /&gt;Outside the range but within the signed byte range:&lt;br /&gt;&lt;br /&gt;If the value is between 128 and 255, it will be converted to binary and then to the byte decimal representation of that binary pattern. In fact, this bit-level interpretation always occurs, but you have to be conscious about it for this special case.&lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;&lt;br /&gt;      int a = 128;&lt;br /&gt;&lt;br /&gt;      byte x = (byte)a; &lt;br /&gt;&lt;br /&gt;      Result: -128&lt;br /&gt;&lt;br /&gt;The bit pattern for 128 is 10000000, but 10000000 is considered to be a signed byte. Thus 10000000 is equal to -128. The next binary number, 10000001, equals to -127. If byte was unsigned, as in C/C++, the decimal value of 1000001 would be 129.&lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;&lt;br /&gt;      int a = 129;&lt;br /&gt;&lt;br /&gt;      byte x = (byte)a; &lt;br /&gt;&lt;br /&gt;      Result: -127&lt;br /&gt;&lt;br /&gt;Outside the signed byte range:&lt;br /&gt;&lt;br /&gt;If the value is greater than 255 or lower than -128, the lower byte of the value is kept and the rest is just thrown away.&lt;br /&gt;&lt;br /&gt;Example #1:&lt;br /&gt;&lt;br /&gt;      int a = 257;&lt;br /&gt;&lt;br /&gt;      byte x = (byte)a; &lt;br /&gt;&lt;br /&gt;      Result: 1 &lt;br /&gt;&lt;br /&gt;      257 = [00000000] [00000000] [00000001] [00000001]&lt;br /&gt;&lt;br /&gt;                       32-bits int value       &lt;br /&gt;&lt;br /&gt;                                         1 = [00000001]&lt;br /&gt;&lt;br /&gt;                                        8-bits byte value&lt;br /&gt;&lt;br /&gt;Example #2:&lt;br /&gt;&lt;br /&gt;      int a = -135;&lt;br /&gt;&lt;br /&gt;      byte x = (byte)a; &lt;br /&gt;&lt;br /&gt;      Result: 121 &lt;br /&gt;&lt;br /&gt;      -135 = [11111111] [11111111] [11111111] [01111001]&lt;br /&gt;&lt;br /&gt;                       32-bits int value       &lt;br /&gt;&lt;br /&gt;                                        121 = [01111001]&lt;br /&gt;&lt;br /&gt;                                        8-bits byte value&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;Casting to (char)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Within the range:&lt;br /&gt;&lt;br /&gt;A char is 16-bits wide unsigned type that holds values between 0 and 65535. Conversion will perform as expected if the value is within the valid range.  &lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;&lt;br /&gt;      int a = 65535;&lt;br /&gt;&lt;br /&gt;      char x = (char)a; &lt;br /&gt;&lt;br /&gt;      Result: 65535&lt;br /&gt;&lt;br /&gt;Outside the range or negative:&lt;br /&gt;&lt;br /&gt;If the value is outside the range because it is lower than 0 or greater than 65535, then the lower 2 bytes will be kept.&lt;br /&gt;&lt;br /&gt;Example #1:&lt;br /&gt;&lt;br /&gt;      int a = 65539;&lt;br /&gt;&lt;br /&gt;      char x = (char)a; &lt;br /&gt;&lt;br /&gt;      Result: 3 &lt;br /&gt;&lt;br /&gt;      65539 = [00000000] [00000001] [00000000] [00000011]&lt;br /&gt;&lt;br /&gt;                       32-bits int value       &lt;br /&gt;&lt;br /&gt;                                3 = [00000000] [00000011]&lt;br /&gt;&lt;br /&gt;                                     16-bits char value&lt;br /&gt;&lt;br /&gt;Example #2:&lt;br /&gt;&lt;br /&gt;      int a = -1;&lt;br /&gt;&lt;br /&gt;      char x = (char)a; &lt;br /&gt;&lt;br /&gt;      Result: 65535 &lt;br /&gt;&lt;br /&gt;         -1 = [11111111] [11111111] [11111111] [11111111]&lt;br /&gt;&lt;br /&gt;                         32-bits int value       &lt;br /&gt;&lt;br /&gt;                            65535 = [11111111] [11111111]&lt;br /&gt;&lt;br /&gt;                                     16-bits char value&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Casting to (short) and other signed integer values&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Values between -32768 and 32767 are converted flawlessly as they are within the valid range. If the value is lower or greater, the lower 2 bytes of the value will be kept to conform a short value. The behaviour is the same as byte casting.&lt;br /&gt;&lt;br /&gt;Other integer values will also behave as expected according to what we've seen at the byte examples.&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;Casting floats or doubles to narrower types&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;On some programming languages, conversion from floating-point numbers to decimals "round" the value. This is not the Java case, the integer part is kept and the rest is thrown away.&lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;&lt;br /&gt;      double a = 1.9999999;&lt;br /&gt;&lt;br /&gt;      int x = (int)a; &lt;br /&gt;&lt;br /&gt;      Result: 1&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Object Reference Conversion&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Object reference conversion takes place in:&lt;br /&gt;&lt;br /&gt;    * Assignment&lt;br /&gt;    * Method call&lt;br /&gt;    * Casting&lt;br /&gt;&lt;br /&gt;(There is no arithmetic promotion)&lt;br /&gt;&lt;br /&gt;Assignment&lt;br /&gt;&lt;br /&gt;Object reference assignment conversion happens when you assign an object reference value to a variable of a different type.&lt;br /&gt;&lt;br /&gt;There are 3 general kinds of object reference type:&lt;br /&gt;&lt;br /&gt;    * A class type, such as Button or TextField&lt;br /&gt;    * An interface type, such as Clonable or LayoutManager&lt;br /&gt;    * An array type, such as int[][] or TextArea[]&lt;br /&gt;    *&lt;br /&gt;&lt;br /&gt;Conversion rules for implicit casting on this context:&lt;br /&gt;&lt;br /&gt;            OLD_Type a = new OLD_Type;&lt;br /&gt;&lt;br /&gt;            NEW_Type b = a;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2056945240977755077-7045924240911943903?l=javacrackers.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/sxbkDxsSfnVKfXFloQHvCUM5FKY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/sxbkDxsSfnVKfXFloQHvCUM5FKY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/sxbkDxsSfnVKfXFloQHvCUM5FKY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/sxbkDxsSfnVKfXFloQHvCUM5FKY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/blogspot/nQxR?a=8KzPvcAZZwo:KQdz4cmWoUg:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/blogspot/nQxR?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://javacrackers.blogspot.com/feeds/7045924240911943903/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://javacrackers.blogspot.com/2007/12/casting-ii.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/7045924240911943903?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/7045924240911943903?v=2" /><link rel="alternate" type="text/html" href="http://javacrackers.blogspot.com/2007/12/casting-ii.html" title="CASTING - II" /><author><name>gautam</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://4.bp.blogspot.com/_ACUdDpwsnW0/Sl6zJQlW8kI/AAAAAAAAAoA/d9Gu11zRf0w/s1600-R/ls_0724_twitte-gatam.JPG" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CkECRng9fyp7ImA9WB9bFUs.&quot;"><id>tag:blogger.com,1999:blog-2056945240977755077.post-9120665151134812876</id><published>2007-12-25T10:55:00.000+05:30</published><updated>2007-12-25T11:01:07.667+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-12-25T11:01:07.667+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="tutorial" /><category scheme="http://www.blogger.com/atom/ns#" term="JAVA" /><title>CASTING</title><content type="html">&lt;BR&gt;Primitives&lt;br /&gt;&lt;br /&gt;Conversion of primitive types may occur in these contexts:&lt;br /&gt;&lt;br /&gt;    * Assignment&lt;br /&gt;    * Method call&lt;br /&gt;    * Arithmetic promotion&lt;br /&gt;    * Explicit casting&lt;br /&gt;&lt;br /&gt;Widening conversions: -&lt;br /&gt;&lt;br /&gt;Your browser may not support display of this image.&lt;br /&gt;&lt;br /&gt;Assignment&lt;br /&gt;&lt;br /&gt;General rules for primitive assignment conversions:&lt;br /&gt;&lt;br /&gt;    * A boolean may not be converted to any other type.&lt;br /&gt;    * A non-boolean may be converted to another non-boolean type, provided the conversion is a widening conversion.&lt;br /&gt;    * A non-boolean may not be converted to another non-boolean type, if the conversion would be a narrowing conversion.&lt;br /&gt;&lt;br /&gt;Example #1:&lt;br /&gt;&lt;br /&gt;      int i = 5;&lt;br /&gt;&lt;br /&gt;      float j = i; &lt;br /&gt;&lt;br /&gt;Method call&lt;br /&gt;&lt;br /&gt;Widening conversion takes place on method calls as on assignments. You can pass to a method any primitive narrower than the expected one. Implicit casting will naturally occur.&lt;br /&gt;&lt;br /&gt;For instance:&lt;br /&gt;&lt;br /&gt;      public static void main(String args[]) {&lt;br /&gt;&lt;br /&gt;            byte x = 126;&lt;br /&gt;&lt;br /&gt;            System.out.println( DoIt(x) );&lt;br /&gt;&lt;br /&gt;      } &lt;br /&gt;&lt;br /&gt;      static String DoIt(int a) {&lt;br /&gt;&lt;br /&gt;            return "I've received an int of value "+a;&lt;br /&gt;&lt;br /&gt;      } &lt;br /&gt;&lt;br /&gt;      Result: I've received an int value of 126&lt;br /&gt;&lt;br /&gt;The method DoIt(int a) expects an int, but you can throw a char, byte or short there, the value will be promoted to int and the method will IN FACT receive an int.&lt;br /&gt;&lt;br /&gt;This special behavior occurs if a method to handle a narrower type hasn't been declared. If you declare a method to handle bytes, then that method will "catch" the call. This is an OOP feature called overloading.&lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;&lt;br /&gt;      public static void main(String args[]) {&lt;br /&gt;&lt;br /&gt;            byte x = 126;&lt;br /&gt;&lt;br /&gt;            System.out.println( DoIt(x) );&lt;br /&gt;&lt;br /&gt;      } &lt;br /&gt;&lt;br /&gt;      static String DoIt(int a) {&lt;br /&gt;&lt;br /&gt;            return "I've received an int of value "+a;&lt;br /&gt;&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;      static String DoIt(byte a) {&lt;br /&gt;&lt;br /&gt;            return "I've received a byte of value "+a;&lt;br /&gt;&lt;br /&gt;      } &lt;br /&gt;&lt;br /&gt;      Result: I've received a byte value of 126&lt;br /&gt;&lt;br /&gt;If the argument type if wider than expected, no implicit casting will occur and you will need to perform an explicit cast:&lt;br /&gt;&lt;br /&gt;      public static void main(String args[]) {&lt;br /&gt;&lt;br /&gt;            float x = 1.26f;&lt;br /&gt;&lt;br /&gt;            System.out.println( DoIt( (int)x ) );&lt;br /&gt;&lt;br /&gt;      } &lt;br /&gt;&lt;br /&gt;      static String DoIt(int a) {&lt;br /&gt;&lt;br /&gt;            return "I've received an int of value "+a;&lt;br /&gt;&lt;br /&gt;      } &lt;br /&gt;&lt;br /&gt;      Result: I've received an int value of 1&lt;br /&gt;&lt;br /&gt;Last example:&lt;br /&gt;&lt;br /&gt;      public static void main(String args[]) {&lt;br /&gt;&lt;br /&gt;            char x = 'A';&lt;br /&gt;&lt;br /&gt;            System.out.println( DoIt(x) );&lt;br /&gt;&lt;br /&gt;      } &lt;br /&gt;&lt;br /&gt;      static String DoIt(int a) {&lt;br /&gt;&lt;br /&gt;            return "I've received an int of value "+a;&lt;br /&gt;&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;      static String DoIt(byte a) {&lt;br /&gt;&lt;br /&gt;            return "I've received a byte of value "+a;&lt;br /&gt;&lt;br /&gt;      } &lt;br /&gt;&lt;br /&gt;      Result: I've received an int value of 65&lt;br /&gt;&lt;br /&gt;As you can see, there's no method to catch char types so the value is promoted to int and caught by DoIt(int a).&lt;br /&gt;&lt;br /&gt;Arithmetic Promotion&lt;br /&gt;&lt;br /&gt;Arithmetic promotion happens when narrower types need to be promoted to wider types in order to make sense in an operation among other wider types.&lt;br /&gt;&lt;br /&gt;Basic rules for binary operators and most of the unary operators:&lt;br /&gt;&lt;br /&gt;    * All arithmetic expressions are promoted to the wider of the operands.&lt;br /&gt;    * The promotion is at least to int, even if no int operand appears.&lt;br /&gt;&lt;br /&gt;These rules don't apply to the unary operators: ++ and -- and assignment operators.&lt;br /&gt;&lt;br /&gt;Example #1:&lt;br /&gt;&lt;br /&gt;      byte x = 1;&lt;br /&gt;&lt;br /&gt;      x++;          // Ok. x is now equal to 2.&lt;br /&gt;&lt;br /&gt;      x = x + 1;    // Error. Expression x + 1 is promoted to int.&lt;br /&gt;&lt;br /&gt;Example #2:&lt;br /&gt;&lt;br /&gt;      byte a = 1;&lt;br /&gt;&lt;br /&gt;      byte x = 23;&lt;br /&gt;&lt;br /&gt;      x &lt;&lt;= a;      // Ok. x is now equal to 46.&lt;br /&gt;&lt;br /&gt;      x = x &lt;&lt; a;   // Error. Expression x &lt;&lt; a is promoted to int.&lt;br /&gt;&lt;br /&gt;Example #3:&lt;br /&gt;&lt;br /&gt;      char a = 5;&lt;br /&gt;&lt;br /&gt;      short x = 3;&lt;br /&gt;&lt;br /&gt;      x *= a;       // Ok. x is now equal to 15.&lt;br /&gt;&lt;br /&gt;      x = x * a;    // Error. Expression x = x * a is promoted to int.&lt;br /&gt;&lt;br /&gt;Example #4:&lt;br /&gt;&lt;br /&gt;      byte a = 15;&lt;br /&gt;&lt;br /&gt;      a = -a;       // Error. -a is promoted to int.&lt;br /&gt;&lt;br /&gt;      a = ~a;       // Error. ~a is promoted to int.&lt;br /&gt;&lt;br /&gt;Example #5:&lt;br /&gt;&lt;br /&gt;      float a = 1.0f;&lt;br /&gt;&lt;br /&gt;      int b = 15;&lt;br /&gt;&lt;br /&gt;      int x = a * b;       // Error. Expression is promoted to float.&lt;br /&gt;&lt;br /&gt;      int x = (int)(a*b);  // Ok. We cast the float result back to int. &lt;br /&gt;&lt;br /&gt;Primitives and Casting&lt;br /&gt;&lt;br /&gt;Casting means explicitly telling Java to make a conversion. A casting operation may widen or narrow its argument. To cast a value, you need to precede it with the name of the desired type enclosed within parentheses:&lt;br /&gt;&lt;br /&gt;      byte x = 15;&lt;br /&gt;&lt;br /&gt;      int r = (int)(x * 3);&lt;br /&gt;&lt;br /&gt;Booleans cannot be casted. Don't bother with them, stuff like this doesn't work:&lt;br /&gt;&lt;br /&gt;      byte a = 1;&lt;br /&gt;&lt;br /&gt;      boolean status = a;&lt;br /&gt;&lt;br /&gt;Narrowing runs the risk of loosing information, in fact, many times you know that you are going to loose information and it is important to know which part information is going to be loosen and naturally, what information will be kept.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2056945240977755077-9120665151134812876?l=javacrackers.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/I54mSfEf1RGU-WAhXR00AioZ7go/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/I54mSfEf1RGU-WAhXR00AioZ7go/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/I54mSfEf1RGU-WAhXR00AioZ7go/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/I54mSfEf1RGU-WAhXR00AioZ7go/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/blogspot/nQxR?a=fZsOb-XTDbU:M5aObLzYkb0:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/blogspot/nQxR?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://javacrackers.blogspot.com/feeds/9120665151134812876/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://javacrackers.blogspot.com/2007/12/casting.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/9120665151134812876?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/9120665151134812876?v=2" /><link rel="alternate" type="text/html" href="http://javacrackers.blogspot.com/2007/12/casting.html" title="CASTING" /><author><name>gautam</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://4.bp.blogspot.com/_ACUdDpwsnW0/Sl6zJQlW8kI/AAAAAAAAAoA/d9Gu11zRf0w/s1600-R/ls_0724_twitte-gatam.JPG" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;C0cASHk9cCp7ImA9WB9bFE0.&quot;"><id>tag:blogger.com,1999:blog-2056945240977755077.post-5502758478844635826</id><published>2007-12-23T14:27:00.000+05:30</published><updated>2007-12-23T14:40:49.768+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-12-23T14:40:49.768+05:30</app:edited><title>Java Video Tutorials</title><content type="html">Are you new to java? Then these video tutorials will help you tke a step forward towards learning java programming.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This video gives an example of a very simple program to make a new java file, compile and run and print a cutom text on the screen.&lt;br /&gt;&lt;object width="425" height="355"&gt;&lt;param name="movie" value="http://www.youtube.com/v/KheL6umdW-s&amp;rel=1"&gt;&lt;/param&gt;&lt;param name="wmode" value="transparent"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/KheL6umdW-s&amp;rel=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;The second video is a tutorial to start using java in Eclipse environment. &lt;br /&gt;&lt;br /&gt;&lt;object width="425" height="355"&gt;&lt;param name="movie" value="http://www.youtube.com/v/UGmhks4K13g&amp;rel=1"&gt;&lt;/param&gt;&lt;param name="wmode" value="transparent"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/UGmhks4K13g&amp;rel=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2056945240977755077-5502758478844635826?l=javacrackers.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/tdH8N2JT_J30-HFDD3FI-GL5cd0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/tdH8N2JT_J30-HFDD3FI-GL5cd0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/tdH8N2JT_J30-HFDD3FI-GL5cd0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/tdH8N2JT_J30-HFDD3FI-GL5cd0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/blogspot/nQxR?a=u84PAabq2yY:GM7AbUvaXhU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/blogspot/nQxR?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://javacrackers.blogspot.com/feeds/5502758478844635826/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://javacrackers.blogspot.com/2007/12/java-video-tutorials.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/5502758478844635826?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/5502758478844635826?v=2" /><link rel="alternate" type="text/html" href="http://javacrackers.blogspot.com/2007/12/java-video-tutorials.html" title="Java Video Tutorials" /><author><name>gautam</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://4.bp.blogspot.com/_ACUdDpwsnW0/Sl6zJQlW8kI/AAAAAAAAAoA/d9Gu11zRf0w/s1600-R/ls_0724_twitte-gatam.JPG" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;Ak8NR388eCp7ImA9WB9UFkQ.&quot;"><id>tag:blogger.com,1999:blog-2056945240977755077.post-8756104773201684960</id><published>2007-12-15T11:38:00.001+05:30</published><updated>2007-12-15T11:38:16.170+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-12-15T11:38:16.170+05:30</app:edited><title>ARRAYS - II</title><content type="html">&lt;span xmlns=''&gt;&lt;p style='text-align: center'&gt;&lt;strong&gt;&lt;span style='font-family:Georgia; font-size:18pt'&gt;Intermediate Arrays&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:24pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;Anonymous arrays&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:18pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;Java 2 added &lt;em&gt;anonymous&lt;/em&gt; arrays, which allow you to create a new array of values anywhere in the program, not just in an initialization in a declaration. &lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;// This anonymous array style can also be used in other statements.&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;String[] days = new String[] {"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"};&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;You can also use anonymous array syntax in other parts of the program. For example, &lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;// Outside a declaration you can make this assignment.&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;x = new String[] {"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"};&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:10pt'&gt;&lt;span style='font-family:Verdana'&gt;You must be careful not to create these anonymous arrays in a loop or as local variables because each use of &lt;/span&gt;&lt;span style='font-family:Courier New'&gt;new&lt;/span&gt;&lt;span style='font-family:Verdana'&gt; will create another array. &lt;/span&gt;&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;Dynamic allocation&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:18pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:10pt'&gt;&lt;span style='font-family:Verdana'&gt;Because arrays are allocated dynamically, the initialization values may arbitrary expresssions. For example, this call creates two new arrays to pass as parameters to &lt;/span&gt;&lt;span style='font-family:Courier New'&gt;drawPolygon&lt;/span&gt;&lt;span style='font-family:Verdana'&gt;. &lt;/span&gt;&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;g.drawPolygon(new int[] {n, n+45, 188}, new int[] {y/2, y*2, y}, 3);&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;C-style array declarations&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:18pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;Java also allows you to write the square brackets &lt;em&gt;after&lt;/em&gt; the variable name, instead of after the type. This is how you write array declarations in C, but is not a good style for Java. C declaration syntax can get very ugly with part of the declaration before the variable, and part after. Java has a much nicer style where all type information can be written together without the use of a variable, and there are times when only the Java notation is possible to use. &lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;   int[] a;   // Java style -- good&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;   int a[];   // C style -- legal, but not Java style&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;Converting between arrays and Collections data structures&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:18pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:7pt'&gt;[TO DO] &lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;Common array problems&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:18pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;Some common array programming mistakes are: &lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;Forgetting that array subscripts start with zero. &lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style='font-size:10pt'&gt;&lt;span style='font-family:Verdana'&gt;Writing &lt;/span&gt;&lt;span style='font-family:Courier New'&gt;a.length()&lt;/span&gt;&lt;span style='font-family:Verdana'&gt; instead of &lt;/span&gt;&lt;span style='font-family:Courier New'&gt;a.length&lt;/span&gt;&lt;span style='font-family:Verdana'&gt;. The &lt;/span&gt;&lt;span style='font-family:Courier New'&gt;length()&lt;/span&gt;&lt;span style='font-family:Verdana'&gt; method is used with Strings, not arrays. &lt;/span&gt;&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style='font-size:10pt'&gt;&lt;span style='font-family:Verdana'&gt;Declaring an array with a size. Eg, &lt;/span&gt;&lt;span style='font-family:Courier New; text-decoration:line-through'&gt;int[100] a;&lt;/span&gt;&lt;span style='font-family:Verdana'&gt; instead of &lt;/span&gt;&lt;span style='font-family:Courier New'&gt;int[] a = new int[100];&lt;/span&gt;&lt;span style='font-family:Verdana'&gt;. &lt;/span&gt;&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;Library methods for arrays&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:18pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:10pt'&gt;&lt;span style='font-family:Verdana'&gt;Static methods for manipulating arrays are available in the &lt;/span&gt;&lt;span style='font-family:Courier New'&gt;java.util.Arrays&lt;/span&gt;&lt;span style='font-family:Verdana'&gt; class. &lt;/span&gt;&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;div style='margin-left: 36pt'&gt;&lt;table border='0' style='border-collapse:collapse'&gt;&lt;colgroup&gt;&lt;col style='width:176px'/&gt;&lt;col style='width:293px'/&gt;&lt;/colgroup&gt;&lt;tbody valign='top'&gt;&lt;tr&gt;&lt;td style='padding-top: 1px; padding-left: 1px; padding-bottom: 1px; padding-right: 1px'&gt;&lt;p&gt;&lt;span style='font-size:10pt'&gt;&lt;span style='font-family:Courier New'&gt;&lt;a name='0.2_table01'/&gt;Arrays.asList()&lt;/span&gt;&lt;span style='font-family:Verdana'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 1px; padding-left: 1px; padding-bottom: 1px; padding-right: 1px'&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;Returns a List based on the array.&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 1px; padding-left: 1px; padding-bottom: 1px; padding-right: 1px'&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;Arrays.toString()&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 1px; padding-left: 1px; padding-bottom: 1px; padding-right: 1px'&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;Returns a readable form of the array.&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 1px; padding-left: 1px; padding-bottom: 1px; padding-right: 1px'&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;Arrays.binarySearch()&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 1px; padding-left: 1px; padding-bottom: 1px; padding-right: 1px'&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;Performs binary serach of a sorted array.&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 1px; padding-left: 1px; padding-bottom: 1px; padding-right: 1px'&gt;&lt;p&gt;&lt;span style='font-size:10pt'&gt;&lt;span style='font-family:Courier New'&gt;Arrays.equals&lt;/span&gt;&lt;span style='font-family:Verdana'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 1px; padding-left: 1px; padding-bottom: 1px; padding-right: 1px'&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;Compares two arrays for equality.&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 1px; padding-left: 1px; padding-bottom: 1px; padding-right: 1px'&gt;&lt;p&gt;&lt;span style='font-size:10pt'&gt;&lt;span style='font-family:Courier New'&gt;Arrays.fill()&lt;/span&gt;&lt;span style='font-family:Verdana'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 1px; padding-left: 1px; padding-bottom: 1px; padding-right: 1px'&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;Fills entire array or subrange with a value.&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 1px; padding-left: 1px; padding-bottom: 1px; padding-right: 1px'&gt;&lt;p&gt;&lt;span style='font-size:10pt'&gt;&lt;span style='font-family:Courier New'&gt;Arrays.sort()&lt;/span&gt;&lt;span style='font-family:Verdana'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 1px; padding-left: 1px; padding-bottom: 1px; padding-right: 1px'&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;Sorts an array.&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;span style='font-size:10pt'&gt;&lt;span style='font-family:Verdana'&gt;In addition there is &lt;/span&gt;&lt;span style='font-family:Courier New'&gt;System.arrayCopy()&lt;/span&gt;&lt;span style='font-family:Verdana'&gt; method. &lt;/span&gt;&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;Anonymous arrays have to be assigned to the variables at the time of declaration of varaible itself. Assigning to the variable after variable declaration is not possible &lt;br/&gt;ie., &lt;br/&gt;int[] i = {1,2,3} is fine. &lt;br/&gt;But, &lt;br/&gt;int[] i; &lt;br/&gt;i = {1,2,3} is compiler error. &lt;br/&gt;This restriction at the time of method invocation is valid, since we don't know the type of array(overloading issue). But for assignment the left side variable type is known. So, why should it be not possible to cast the anonymous array {1,2,3} to int[] and assign to variable. &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman'&gt;&lt;strong&gt;&lt;span style='font-size:13pt; text-decoration:underline'&gt;i=i++ produces the output "0″ instead of "1″.&lt;/span&gt;&lt;span style='font-size:18pt'&gt;&lt;br /&gt;						&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;The code &lt;br/&gt;int i = 0; &lt;br/&gt;i = i++; &lt;br/&gt;System.out.println(i); &lt;br/&gt;produces the output "0″ instead of "1″.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;"i = i++" roughly translates to&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;int oldValue = i; &lt;br/&gt;i = i + 1; &lt;br/&gt;i = oldValue; &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman'&gt;&lt;strong&gt;&lt;span style='font-size:13pt; text-decoration:underline'&gt;Array and ArrayList&lt;/span&gt;&lt;span style='font-size:18pt'&gt;&lt;br /&gt;						&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;In a arrayList of object, any types of object(mixed) can be put. However in an array of objects, once initialized to a particular object type, other type of objects cannot be put.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;Thus,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;ArrayList a = new ArrayList(); &lt;br/&gt;a.add("krishna"); &lt;br/&gt;a.add(5);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;is allowed and will run fine.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;However,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;Object[] obj = new String[5]; &lt;br/&gt;obj[0] = new Integer(1);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;will throw ArrayStoreException(is a RunTimeException).&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;With generics, arraylist is also not allowed to store Integer if it is declared as ArrayList of String. Thus, with generics, &lt;br/&gt;ArrayList&amp;lt;String&amp;gt; a = new ArrayList&amp;lt;String&amp;gt;(); &lt;br/&gt;a.add("krishna"); &lt;br/&gt;a.add(5);  — will be compiler error(unlike array which is at rutime).&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;But with generics also, one more difference is array  allows polymorphic assignment., i.e.,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;Number[] n = new Integer[5];&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;However, in case of generics, polymorphic assignment holds good only for the base&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;type and not for the generic type. i.e.,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;List&amp;lt;Integer&amp;gt; l = new ArrayList&amp;lt;Integer&amp;gt;;  — for base type hold good&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;ArrayList&amp;lt;Number&amp;gt; n = new ArrayList&amp;lt;Integer&amp;gt;; — not allowed for generic type &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2056945240977755077-8756104773201684960?l=javacrackers.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/qXFllGeKthIFSj-wbAPsQ0SbWLQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/qXFllGeKthIFSj-wbAPsQ0SbWLQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/qXFllGeKthIFSj-wbAPsQ0SbWLQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/qXFllGeKthIFSj-wbAPsQ0SbWLQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/blogspot/nQxR?a=isUypo3r8zQ:bcqJEmh5U44:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/blogspot/nQxR?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://javacrackers.blogspot.com/feeds/8756104773201684960/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://javacrackers.blogspot.com/2007/12/arrays-ii.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/8756104773201684960?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/8756104773201684960?v=2" /><link rel="alternate" type="text/html" href="http://javacrackers.blogspot.com/2007/12/arrays-ii.html" title="ARRAYS - II" /><author><name>gautam</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://4.bp.blogspot.com/_ACUdDpwsnW0/Sl6zJQlW8kI/AAAAAAAAAoA/d9Gu11zRf0w/s1600-R/ls_0724_twitte-gatam.JPG" /></author><thr:total>1</thr:total></entry><entry gd:etag="W/&quot;Ak8EQnk8fyp7ImA9WB9UFkQ.&quot;"><id>tag:blogger.com,1999:blog-2056945240977755077.post-354956259117026052</id><published>2007-12-15T11:36:00.001+05:30</published><updated>2007-12-15T11:36:43.777+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-12-15T11:36:43.777+05:30</app:edited><title>ARRAYS  - I</title><content type="html">&lt;span xmlns=''&gt;&lt;p style='text-align: center'&gt;&lt;strong&gt;&lt;span style='font-family:Georgia; font-size:18pt; text-decoration:underline'&gt;&lt;em&gt;Arrays&lt;/em&gt;&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:24pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;Java arrays are similar to ideas in mathematics&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:18pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;An array can store many similar values in memory. Each value can be accessed by specifying a &lt;em&gt;subscript&lt;/em&gt; or &lt;em&gt;index&lt;/em&gt;. "Array" in Java means approximately the same thing as &lt;em&gt;array&lt;/em&gt;, &lt;em&gt;matrix&lt;/em&gt;, or &lt;em&gt;vector&lt;/em&gt; does in math. &lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;Unlike math, you must declare the array and allocate a &lt;em&gt;fixed&lt;/em&gt; amount of memory for it. &lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style='font-family:Times New Roman; font-size:18pt'&gt; &lt;br/&gt;&lt;/span&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;Declaring an array&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:18pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;An array variable is like other variables -- you must declare it, which means you must declare the &lt;em&gt;type&lt;/em&gt; of elements that are in an array. All elements must be the same type. Write the element type name, then "[]", then the name of the array variable. The declaration allocates only enough space for a reference to an array (typically 4 bytes), but doesn't create the actual array object. &lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;String[]  args;   // args is an array of Strings&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;int[]     scores; // scores is an array of ints&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;JButton[] bs;     // bs is an array of JButtons&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;&lt;strong&gt;No size in declaration&lt;/strong&gt;. Unlike some languages, &lt;em&gt;never&lt;/em&gt; put the size of the array in the declaration because an array declaration specifies only the element type and the variable name. &lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;Allocate an array object with &lt;/span&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;new&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:18pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:10pt'&gt;&lt;span style='font-family:Verdana'&gt;Create an array using &lt;/span&gt;&lt;span style='font-family:Courier New'&gt;&lt;strong&gt;new&lt;/strong&gt;&lt;/span&gt;&lt;span style='font-family:Verdana'&gt;. This example creates an array of 100 int elements, from &lt;/span&gt;&lt;span style='font-family:Courier New'&gt;a[0]&lt;/span&gt;&lt;span style='font-family:Verdana'&gt; to &lt;/span&gt;&lt;span style='font-family:Courier New'&gt;a[99]&lt;/span&gt;&lt;span style='font-family:Verdana'&gt;. &lt;/span&gt;&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;int[] a;           // Declare a to be an array of ints&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;a = &lt;strong&gt;new int[100]&lt;/strong&gt;;  // Allocate an array of 100 ints&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;These are often combined in one line.&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;int[] a = &lt;strong&gt;new int[100]&lt;/strong&gt;;  // Declare and allocate.&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;Subscripts&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:18pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:10pt'&gt;&lt;strong&gt;&lt;span style='font-family:Verdana'&gt;Subscripts are enclosed in square brackets &lt;/span&gt;&lt;span style='font-family:Courier New'&gt;[]&lt;/span&gt;&lt;/strong&gt;&lt;span style='font-family:Verdana'&gt;. &lt;/span&gt;&lt;span style='font-family:Courier New'&gt;&lt;strong&gt;x&lt;sub&gt;i&lt;/sub&gt;&lt;/strong&gt;&lt;/span&gt;&lt;span style='font-family:Verdana'&gt; in mathematics is &lt;/span&gt;&lt;span style='font-family:Courier New'&gt;&lt;strong&gt;x[i]&lt;/strong&gt;&lt;/span&gt;&lt;span style='font-family:Verdana'&gt; in Java, and is pronounced "x-sub-i". &lt;/span&gt;&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;&lt;strong&gt;Subscript ranges always start at zero&lt;/strong&gt; because Java came largely from C++, which had a good reason for using zero (pointer arithmetic on arrays). It isn't the way that humans normally count; you'll just have to live with it. &lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:10pt'&gt;&lt;span style='font-family:Verdana'&gt;&lt;strong&gt;Java always checks subscript legality&lt;/strong&gt; to be sure the subscript is &amp;gt;= 0, and less than the number of elements in the array. If the subscript is outside this range, Java throws &lt;/span&gt;&lt;span style='font-family:Courier New'&gt;ArrayIndexOutOfBoundsException&lt;/span&gt;&lt;span style='font-family:Verdana'&gt;. This is far superior to the behavior of C and C++, which allow out of range references. Consequently, Java programs are far less susceptible to bugs and security flaws than C/C++ programs. &lt;/span&gt;&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;Length of an array&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:18pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:10pt'&gt;&lt;span style='font-family:Verdana'&gt;Each array has a constant (&lt;/span&gt;&lt;span style='font-family:Courier New'&gt;final&lt;/span&gt;&lt;span style='font-family:Verdana'&gt;) instance variable that has its length. You can find out how many elements an array can hold by writing the array name followed by &lt;/span&gt;&lt;span style='font-family:Courier New'&gt;&lt;strong&gt;.length&lt;/strong&gt;&lt;/span&gt;&lt;span style='font-family:Verdana'&gt;. In the previous example, &lt;/span&gt;&lt;span style='font-family:Courier New'&gt;a.length&lt;/span&gt;&lt;span style='font-family:Verdana'&gt; would be 100. Remember that this is the number of elements in the array, one more than the maximum subscript. &lt;/span&gt;&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;Java idiom for looping over an array&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:18pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:10pt'&gt;&lt;span style='font-family:Verdana'&gt;The most common use of &lt;/span&gt;&lt;span style='font-family:Courier New'&gt;.length&lt;/span&gt;&lt;span style='font-family:Verdana'&gt; is in a for loop test condition. For example, the variable &lt;/span&gt;&lt;span style='font-family:Courier New'&gt;i&lt;/span&gt;&lt;span style='font-family:Verdana'&gt; will go over the entire range of subscripts of the array &lt;/span&gt;&lt;span style='font-family:Courier New'&gt;a&lt;/span&gt;&lt;span style='font-family:Verdana'&gt;. &lt;/span&gt;&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;for (int i=0; i &amp;lt; a&lt;strong&gt;.length&lt;/strong&gt;; i++) { &lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;    . . .&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;}&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:10pt'&gt;&lt;span style='font-family:Verdana'&gt;If you only need to reference the &lt;em&gt;value&lt;/em&gt; of each of the elements, you can use the somewhat simpler Java 5 for loop, which keeps track of the index and assigns successive values to a variable (&lt;/span&gt;&lt;span style='font-family:Courier New'&gt;v&lt;/span&gt;&lt;span style='font-family:Verdana'&gt; in this example).&lt;/span&gt;&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;for (int v : a) { &lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;    . . .&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;}&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;Example Version 1 -- Adding all elements of an array&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:18pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;These statements create an array and put 1000 random values in it. The second loop adds all 1000 elements. It would have been better to add them in the first loop, but writing it this way allows two examples of loops. &lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;int[] a;           // Declare an array of ints&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;a = new int[1000]; // Create an array of 1000 ints, a[0]...a[999]&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt; &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;//... Assign random values to each element.&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;for (int i=0; i&amp;lt;a.length(); i++) {&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;    a[i] = (int)(Math.random() * 100000);  // Random number 0-99999&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;}&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt; &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;//... Add all values in the array.&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;int sum = 0;           // Start the total sum at 0.&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;for (int i=0; i&amp;lt;a.length; i++) {&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;    sum = sum + a[i];  // Add the next element to the total&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;}&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;Example Version 2 -- Adding all elements of an array in Java 5&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:18pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;This is the the same as above, but uses the Java 5 "for each" loop to do the sum, which frees you from using an index if you simply need to get all successive values. This kind of loop only gets the values, so it couldn't have been used to set the values in the first loop above. &lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;. . .&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;int sum = 0;        // Start the total sum at 0.&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;for (int v : a) {&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;    sum = sum + v;  // Add the next element to the total&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;}&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;Initial array element values -- zero/null/false&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:18pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:10pt'&gt;&lt;span style='font-family:Verdana'&gt;When an array is allocated (with &lt;/span&gt;&lt;span style='font-family:Courier New'&gt;new&lt;/span&gt;&lt;span style='font-family:Verdana'&gt;), all elements are set to an initial value. The initial value is 0 if the element type is numeric (int, float, ...), &lt;/span&gt;&lt;span style='font-family:Courier New'&gt;false&lt;/span&gt;&lt;span style='font-family:Verdana'&gt; for boolean, and &lt;/span&gt;&lt;span style='font-family:Courier New'&gt;null&lt;/span&gt;&lt;span style='font-family:Verdana'&gt; for all object types. &lt;/span&gt;&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;Array Initialization&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:18pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;When you declare an array, you can can also allocate a preinitialized array object in the same statement. In this case, do not give the array size because Java counts the number of values to determine the size. For example, &lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;// Java 1.0 style -- shorter, but can be used ONLY IN DECLARATIONS&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;String[] days = {"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"};&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style='font-family:Verdana; font-size:10pt'&gt;Array variables are &lt;em&gt;references&lt;/em&gt; to arrays&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:18pt'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:10pt'&gt;&lt;span style='font-family:Verdana'&gt;When you declare an array variable, Java reserves only enough memory for a &lt;em&gt;reference&lt;/em&gt; (Java's name for an &lt;em&gt;address&lt;/em&gt; or &lt;em&gt;pointer&lt;/em&gt;) to an array object. References typically require only 4 bytes. When an array object is created with &lt;/span&gt;&lt;span style='font-family:Courier New'&gt;new&lt;/span&gt;&lt;span style='font-family:Verdana'&gt;, a reference is returned, and that reference can then be assigned to a variable. When you assign one array variable to another, only the reference is copied. For example, &lt;/span&gt;&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;int[] a = new int[] {100, 99, 98};&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;int[] b;&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;// "a" points to an array, and "b" doesn't point to anything&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;b = a;      // Now b referes to the SAME array as "a"&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;b[1] = 0;   // Also changes a[1] because a and b refer to the same array.&lt;/span&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;				&lt;/span&gt;&lt;/p&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;// Both a and b refer to same array with value {100, 0, 98}&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2056945240977755077-354956259117026052?l=javacrackers.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/mijRBXrANX3ytOYOukMfAC7QnQQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/mijRBXrANX3ytOYOukMfAC7QnQQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/mijRBXrANX3ytOYOukMfAC7QnQQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/mijRBXrANX3ytOYOukMfAC7QnQQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/blogspot/nQxR?a=q48K9m-X2-M:nhq0HiNfzug:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/blogspot/nQxR?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://javacrackers.blogspot.com/feeds/354956259117026052/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://javacrackers.blogspot.com/2007/12/arrays-i.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/354956259117026052?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/354956259117026052?v=2" /><link rel="alternate" type="text/html" href="http://javacrackers.blogspot.com/2007/12/arrays-i.html" title="ARRAYS  - I" /><author><name>gautam</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://4.bp.blogspot.com/_ACUdDpwsnW0/Sl6zJQlW8kI/AAAAAAAAAoA/d9Gu11zRf0w/s1600-R/ls_0724_twitte-gatam.JPG" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;C0ABRn8zfCp7ImA9WB9UFk8.&quot;"><id>tag:blogger.com,1999:blog-2056945240977755077.post-7482706608825356737</id><published>2007-12-14T13:56:00.000+05:30</published><updated>2007-12-14T14:12:37.184+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-12-14T14:12:37.184+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="mobile" /><category scheme="http://www.blogger.com/atom/ns#" term="money" /><category scheme="http://www.blogger.com/atom/ns#" term="make" /><title>Make Money From Your Mobile</title><content type="html">&lt;a href="http://www.mginger.com/index.jsp?inviteId=484821"&gt;Mginger&lt;/a&gt; is a program in India which pays mobile users to receive SMS ads.These Ads are displayed according to the preference of the user and therefore Ads are very relevant.The best thing is that by receiving these ads ,we also get to know about new offers and Latest products and also get to know about discounts on apparels and other shopping items.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Registration is straightforward, you need your name, phone number and a few location details. In addition to this, you must select 5 Interests, such as music, gaming etc, this will “fine tune” your ads that you receive. Sooooo, where’s the money, well for every ad that you receive you get 20 paisa, and for every ad that your friend gets you get 10 paisa, and if your friend’s friend’s gets an ad you get 5 paisa. Now it may not sound like much, but it could add up.&lt;br /&gt;You get paid Per SMS received and when the balance reaches 300 you can request a payment which will be delivered at address specified in your profile.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;As these mobile ads can be received on any mobile and one account refers to one mobile.So If you have more than one mobile you can sign one account for each mobile.&lt;br /&gt;&lt;br /&gt;To Sign UP visit the link below&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.mginger.com/index.jsp?inviteId=484821"&gt;www.mginger.com&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2056945240977755077-7482706608825356737?l=javacrackers.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/R_TIRGnv5_6tjSg56aDy1ai85mE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/R_TIRGnv5_6tjSg56aDy1ai85mE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/R_TIRGnv5_6tjSg56aDy1ai85mE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/R_TIRGnv5_6tjSg56aDy1ai85mE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/blogspot/nQxR?a=FtVPC8jBKUY:OB-9MsCiMeQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/blogspot/nQxR?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://javacrackers.blogspot.com/feeds/7482706608825356737/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://javacrackers.blogspot.com/2007/12/make-money-from-your-mobile.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/7482706608825356737?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/7482706608825356737?v=2" /><link rel="alternate" type="text/html" href="http://javacrackers.blogspot.com/2007/12/make-money-from-your-mobile.html" title="Make Money From Your Mobile" /><author><name>gautam</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://4.bp.blogspot.com/_ACUdDpwsnW0/Sl6zJQlW8kI/AAAAAAAAAoA/d9Gu11zRf0w/s1600-R/ls_0724_twitte-gatam.JPG" /></author><thr:total>2</thr:total></entry><entry gd:etag="W/&quot;A0cHSHc_cSp7ImA9WB9UFk0.&quot;"><id>tag:blogger.com,1999:blog-2056945240977755077.post-6559886119704074510</id><published>2007-12-14T10:38:00.001+05:30</published><updated>2007-12-14T10:40:39.949+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-12-14T10:40:39.949+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SCJP" /><category scheme="http://www.blogger.com/atom/ns#" term="DUMPS" /><category scheme="http://www.blogger.com/atom/ns#" term="JAVA" /><title>JAVA DUMPS 19 (SCJP)</title><content type="html">&lt;span xmlns=''&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 6&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;Which statement is true?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;A. Memory is reclaimed by calling Runtime.gc().&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;B. Objects are not collected if they are accessible from live threads.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;C. Objects that have finalize() methods are never garbage collected.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;D. Objects that have finalize() methods always have their finalize() methods called before&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;the program ends.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;E. An OutOfMemory error is only thrown if a single block of memory cannot be found&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Times New Roman'&gt;that is large enough for a particular requirement.&lt;/span&gt;&lt;span style='font-family:Times New Roman'&gt;&lt;strong&gt;&lt;br /&gt;						&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;Answer: B&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 7&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;1. class A {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;2. A() { }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;3. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;4.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;5. class B extends A {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;6. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;Which two statements are true? (Choose two)&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;A. Class B's constructor is public.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;B. Class B's constructor has no arguments.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;C. Class B's constructor includes a call to this().&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;D. Class B's constructor includes a call to super().&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;Answer: B, D&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 8&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;11. int i = 1,j = 10;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;12. do {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;13. if(i&amp;gt;j) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;14. break;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;15. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;16. j--;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;17. } while (++i &amp;lt;5);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;18. System.out.println("i =" +i+" and j = "+j);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;What is the result?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Times New Roman'&gt;A. &lt;/span&gt;&lt;span style='font-family:Times New Roman'&gt;i = 6 and j = 5&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Times New Roman'&gt;B. &lt;/span&gt;&lt;span style='font-family:Times New Roman'&gt;i = 5 and j = 5&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Times New Roman'&gt;C. &lt;/span&gt;&lt;span style='font-family:Times New Roman'&gt;i = 6 and j = 4&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Times New Roman'&gt;D. &lt;/span&gt;&lt;span style='font-family:Times New Roman'&gt;i = 5 and j = 6&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Times New Roman'&gt;E. &lt;/span&gt;&lt;span style='font-family:Times New Roman'&gt;i = 6 and j = 6&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;Answer: D&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 9&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;Which statement is true?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;A. Assertions can be enabled or disabled on a class-by-class basis.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;B. Conditional compilation is used to allow tested classes to run at full speed.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;C. Assertions are appropriate for checking the validity of arguments in a method.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;D. The programmer can choose to execute a return statement or to throw an exception if&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;an assertion fails.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;Answer: A&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 10&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;You want a class to have access to members of another class in the same package. Which&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;is the most restrictive access that accomplishes this objective?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;A. public&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;B. private&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;C. protected&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;D. transient&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;E. default access&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;Answer: E&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2056945240977755077-6559886119704074510?l=javacrackers.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Flp2c5mulK79nbCY4cfBLWSY5K0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Flp2c5mulK79nbCY4cfBLWSY5K0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Flp2c5mulK79nbCY4cfBLWSY5K0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Flp2c5mulK79nbCY4cfBLWSY5K0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/blogspot/nQxR?a=bfITtsaQlpM:FEuAkQ_eCjg:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/blogspot/nQxR?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://javacrackers.blogspot.com/feeds/6559886119704074510/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://javacrackers.blogspot.com/2007/12/java-dumps-19-scjp.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/6559886119704074510?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/6559886119704074510?v=2" /><link rel="alternate" type="text/html" href="http://javacrackers.blogspot.com/2007/12/java-dumps-19-scjp.html" title="JAVA DUMPS 19 (SCJP)" /><author><name>gautam</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://4.bp.blogspot.com/_ACUdDpwsnW0/Sl6zJQlW8kI/AAAAAAAAAoA/d9Gu11zRf0w/s1600-R/ls_0724_twitte-gatam.JPG" /></author><thr:total>1</thr:total></entry><entry gd:etag="W/&quot;A0cHSHc_cSp7ImA9WB9UFk0.&quot;"><id>tag:blogger.com,1999:blog-2056945240977755077.post-7025455580205155892</id><published>2007-12-14T10:36:00.001+05:30</published><updated>2007-12-14T10:40:39.949+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-12-14T10:40:39.949+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SCJP" /><category scheme="http://www.blogger.com/atom/ns#" term="DUMPS" /><category scheme="http://www.blogger.com/atom/ns#" term="JAVA" /><title>JAVA  DUMPS 18 (SCJP)</title><content type="html">&lt;span xmlns=''&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 1&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;1. public class Test {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;2. public static void main(String args[]) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;3. class Foo {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;4. public int i = 3;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;5. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;6. Object o = (Object)new Foo();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;7. Foo foo = (Foo)o;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;8. System.out.println("i = " + foo.i);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;9. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;10. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;What is the result?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Times New Roman'&gt;A. &lt;/span&gt;&lt;span style='font-family:Times New Roman'&gt;i = 3&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;B. Compilation fails.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;C. A ClassCastException is thrown at line 6.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;D. A ClassCastException is thrown at line 7.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;Answer: A&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 2&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;Which two cause a compiler error? (Choose two)&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Times New Roman'&gt;A. &lt;/span&gt;&lt;span style='font-family:Times New Roman'&gt;float[] = new float(3);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Times New Roman'&gt;B. &lt;/span&gt;&lt;span style='font-family:Times New Roman'&gt;float f2[] = new float[];&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Times New Roman'&gt;C. &lt;/span&gt;&lt;span style='font-family:Times New Roman'&gt;float[] f1 = new float[3];&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Times New Roman'&gt;D. &lt;/span&gt;&lt;span style='font-family:Times New Roman'&gt;float f3[] = new float[3];&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Times New Roman'&gt;E. &lt;/span&gt;&lt;span style='font-family:Times New Roman'&gt;float f5[] = { 1.0f, 2.0f, 2.0f };&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Times New Roman'&gt;F. &lt;/span&gt;&lt;span style='font-family:Times New Roman'&gt;float f4[] = new float[] { 1.0f. 2.0f. 3.0f};&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;Answer: A, B&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 3&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;11. int i =1,j =10;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;12. do {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;13. if(i++&amp;gt; --j) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;14. continue;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;15. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;16. } while (i &amp;lt;5);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;17. System.out.println("i = " +i+ "and j = "+j);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;What is the result?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Times New Roman'&gt;A. &lt;/span&gt;&lt;span style='font-family:Times New Roman'&gt;i = 6 and j = 5&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Times New Roman'&gt;B. &lt;/span&gt;&lt;span style='font-family:Times New Roman'&gt;i = 5 and j = 5&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Times New Roman'&gt;C. &lt;/span&gt;&lt;span style='font-family:Times New Roman'&gt;i = 6 and j = 5&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Times New Roman'&gt;D. &lt;/span&gt;&lt;span style='font-family:Times New Roman'&gt;i = 5 and j = 6&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Times New Roman'&gt;E. &lt;/span&gt;&lt;span style='font-family:Times New Roman'&gt;i = 6 and j = 6&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;Answer: D&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 4&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;1. class Test {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;2. private Demo d;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;3. void start() {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;4. d = new Demo();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;5. this.takeDemo(d);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;6. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;7.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;8. void takeDemo(Demo demo) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;9. demo = null;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;10. demo = new Demo();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;11. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;12. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;When is the Demo object, created on line 3, eligible for garbage collection?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;A. After line 5.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;B. After line 9.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;C. After the start() method completes.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;D. When the takeDemo() method completes.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;E. When the instance running this code is made eligible for garbage collection.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;Answer: E&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 5&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;1. interface Animal {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;2. void soundOff();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;3. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;4.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;5. class Elephant implements Animal {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;6. public void soundOff() {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;7. System.out.println("Trumpet");&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;8. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;9. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;10.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;11. class Lion implements Animal {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;12. public void soundOff() {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;13. System.out.println("Roar");&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;14. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;15. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;16.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;17. class Alpha1 {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;18. static Animal get( String choice ) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;19. if ( choice.equalsIgnoreCase( "meat eater" )) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;20. return new Lion();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;21. } else {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;22. return new Elephant();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;23. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;24. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;25. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;Which compiles?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Times New Roman'&gt;A. &lt;/span&gt;&lt;span style='font-family:Times New Roman'&gt;new Animal().soundOff();&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Times New Roman'&gt;B. &lt;/span&gt;&lt;span style='font-family:Times New Roman'&gt;Elephant e = new Alpha1();&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Times New Roman'&gt;C. &lt;/span&gt;&lt;span style='font-family:Times New Roman'&gt;Lion 1 = Alpha.get("meat eater");&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Times New Roman'&gt;D. &lt;/span&gt;&lt;span style='font-family:Times New Roman'&gt;new Alpha1().get("veggie").soundOff();&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:11pt'&gt;&lt;strong&gt;Answer: D&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2056945240977755077-7025455580205155892?l=javacrackers.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Q2_kWoIkw9K1C8wNmmjhTYzbm0I/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Q2_kWoIkw9K1C8wNmmjhTYzbm0I/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Q2_kWoIkw9K1C8wNmmjhTYzbm0I/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Q2_kWoIkw9K1C8wNmmjhTYzbm0I/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/blogspot/nQxR?a=orbw5WKPlEo:w6j5ydLQ4Lw:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/blogspot/nQxR?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://javacrackers.blogspot.com/feeds/7025455580205155892/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://javacrackers.blogspot.com/2007/12/java-dumps-18-scjp.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/7025455580205155892?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/7025455580205155892?v=2" /><link rel="alternate" type="text/html" href="http://javacrackers.blogspot.com/2007/12/java-dumps-18-scjp.html" title="JAVA  DUMPS 18 (SCJP)" /><author><name>gautam</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://4.bp.blogspot.com/_ACUdDpwsnW0/Sl6zJQlW8kI/AAAAAAAAAoA/d9Gu11zRf0w/s1600-R/ls_0724_twitte-gatam.JPG" /></author><thr:total>1</thr:total></entry><entry gd:etag="W/&quot;A0cHSHc-eCp7ImA9WB9UFk0.&quot;"><id>tag:blogger.com,1999:blog-2056945240977755077.post-5805810823325571189</id><published>2007-12-11T16:09:00.001+05:30</published><updated>2007-12-14T10:40:39.950+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-12-14T10:40:39.950+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SCJP" /><category scheme="http://www.blogger.com/atom/ns#" term="DUMPS" /><category scheme="http://www.blogger.com/atom/ns#" term="JAVA" /><title>JAVA DUMPS 17 (SCJP)</title><content type="html">&lt;span xmlns=''&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 92&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;1. abstract class AbstractIt {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;2. abstract float getFloat();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;3. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;4. public class AbstractTest extends AbstractIt {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;5. private float f1 = 1.0f;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;6. private float getFloat() { return f1; }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;7. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;What is the result?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;A. Compilation succeeds.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;B. An exception is thrown.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;C. Compilation fails because of an error at line 2.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;D. Compilation fails because of an error at line 6.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: D&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 93&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Which four can be thrown using the throw statement? (Choose four)&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;A. Error&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;B. Event&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;C. Object&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;D. Throwable&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;E. Exception&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;F. RuntimeException&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: A, D, E, F&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 94&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;What produces a compiler error?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;A. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;class A {&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;public A(int x) {}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;B. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;class A {&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;class B extends A {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;B() {}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;C. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;class A {&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;A() {}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;class B {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;public B() {}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;D. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;class Z {&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;public Z(int) {}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;class A extends Z {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: D&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 95&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;11. for( int i = min; i &amp;lt;max; i++) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;12. System.out.println(i);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;13. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;&lt;strong&gt;If min and max are arbitrary integers, what gives the same result&lt;/strong&gt;&lt;/span&gt;&lt;span style='font-family:Arial'&gt;?&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;A. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;init i = min;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;while( i &amp;lt; max ) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;B. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;int i = min;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;do&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;System.out.println(i++);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;} while( i&amp;lt; max );&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;C. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;for (int i=min; i&amp;lt;max; System.out.println(++I));&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;D. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;for (int i=; i++&amp;lt;max; System.out.println(i));&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: B&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2056945240977755077-5805810823325571189?l=javacrackers.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/SSKzQxi1j-QNTEd8YI4YPx0VeRg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/SSKzQxi1j-QNTEd8YI4YPx0VeRg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/SSKzQxi1j-QNTEd8YI4YPx0VeRg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/SSKzQxi1j-QNTEd8YI4YPx0VeRg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/blogspot/nQxR?a=2d3zIdGqsEs:8Aoo8fKnx5E:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/blogspot/nQxR?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://javacrackers.blogspot.com/feeds/5805810823325571189/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://javacrackers.blogspot.com/2007/12/java-dumps-17-scjp.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/5805810823325571189?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/5805810823325571189?v=2" /><link rel="alternate" type="text/html" href="http://javacrackers.blogspot.com/2007/12/java-dumps-17-scjp.html" title="JAVA DUMPS 17 (SCJP)" /><author><name>gautam</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://4.bp.blogspot.com/_ACUdDpwsnW0/Sl6zJQlW8kI/AAAAAAAAAoA/d9Gu11zRf0w/s1600-R/ls_0724_twitte-gatam.JPG" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;A0cHSHc-eSp7ImA9WB9UFk0.&quot;"><id>tag:blogger.com,1999:blog-2056945240977755077.post-2988718870537762670</id><published>2007-12-09T10:02:00.001+05:30</published><updated>2007-12-14T10:40:39.951+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-12-14T10:40:39.951+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SCJP" /><category scheme="http://www.blogger.com/atom/ns#" term="DUMPS" /><category scheme="http://www.blogger.com/atom/ns#" term="JAVA" /><title>JAVA DUMPS 16 (SCJP)</title><content type="html">&lt;span xmlns=''&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 85&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;12. float f[][][] = new float[3][][];&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;13. float f0 = 1.0f;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;14. float[][] farray = new float[1][1];&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;What is valid?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;A. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;f[0] = f0;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;B. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;f[0] = farray;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;C. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;f[0] = farray[0];&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;D. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;f[0] = farray[0][0];&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: B&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 86&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;11. for (int i =0; i &amp;lt; 4; i +=2) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;12. System.out.print(i + "");&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;13. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;14. System.out.println(i);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;What is the result?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;A. 0 2 4&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;B. 0 2 4 5&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;C. 0 1 2 3 4&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;D. Compilation fails.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;E. An exception is thrown at runtime.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: D&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 87&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;12. void start() {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;13. A a = new A();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;14. B b = new B();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;15. a.s(b);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;16. b = null;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;17. a = null;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;18. System.out.printIn("start completed");&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;19. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;When is the B object, created in line 14, eligible for garbage collection?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;A. After line 16.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;B. After line 17.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;C. After line 18 (when the methods ends).&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;D. There is no way to be absolutely certain.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;E. The object is NOT eligible for garbage collection.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: C&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 88&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;1. public class Exception Test {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;2. class TestException extends Exception {}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;3. public void runTest() throws TestException {}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;4. public void test() /* Point X */ {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;5. runTest();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;6. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;7. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;At Point X on line 4, which code is necessary to make the code compile?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;A. No code is necessary.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;B. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;throws Exception&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;C. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;catch ( Exception e )&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;D. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;throws RuntimeException&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;E. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;catch ( TestException e)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: B&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 89&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;11. int i = 0;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;12. while (true) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;13. if(i==4) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;14. break;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;15. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;16. ++i;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;17. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;18. System.out.println("i="+i);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;What is the result?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;A. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;i = 0&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;B. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;i = 3&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;C. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;i = 4&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;D. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;i = 5&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;E. Compilation fails.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: C&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 90&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;11. try {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;12. int x = 0;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;13. int y = 5 / x;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;14. } catch (Exception e) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;15. System.out.println("Exception");&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;16. } catch (ArithmeticException ae) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;17. System.out.println("Arithmetic Exception");&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;18. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;19. System.out.println("finished");&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;What is the result?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;A. finished&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;B. Exception&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;C. Compilation fails.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;D. Arithmetic Exception&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: C&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 91&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;1. public class Test { }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;What is the prototype of the default constructor?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;A. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;Test()&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;B. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;Test(void)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;C. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;public Test()&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;D. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;public Test(void)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;E. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;public void Test()&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: A&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2056945240977755077-2988718870537762670?l=javacrackers.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/hpKkbrjHj62z-eDTVoRVZUDgp8w/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/hpKkbrjHj62z-eDTVoRVZUDgp8w/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/hpKkbrjHj62z-eDTVoRVZUDgp8w/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/hpKkbrjHj62z-eDTVoRVZUDgp8w/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/blogspot/nQxR?a=o07lZf6fhqo:YZmfoTKA4D4:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/blogspot/nQxR?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://javacrackers.blogspot.com/feeds/2988718870537762670/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://javacrackers.blogspot.com/2007/12/java-dumps-16-scjp.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/2988718870537762670?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/2988718870537762670?v=2" /><link rel="alternate" type="text/html" href="http://javacrackers.blogspot.com/2007/12/java-dumps-16-scjp.html" title="JAVA DUMPS 16 (SCJP)" /><author><name>gautam</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://4.bp.blogspot.com/_ACUdDpwsnW0/Sl6zJQlW8kI/AAAAAAAAAoA/d9Gu11zRf0w/s1600-R/ls_0724_twitte-gatam.JPG" /></author><thr:total>2</thr:total></entry><entry gd:etag="W/&quot;A0cHSHc-eSp7ImA9WB9UFk0.&quot;"><id>tag:blogger.com,1999:blog-2056945240977755077.post-6443440350315819347</id><published>2007-12-09T09:59:00.001+05:30</published><updated>2007-12-14T10:40:39.951+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-12-14T10:40:39.951+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SCJP" /><category scheme="http://www.blogger.com/atom/ns#" term="DUMPS" /><category scheme="http://www.blogger.com/atom/ns#" term="JAVA" /><title>JAVA DUMPS 15 (SCJP)</title><content type="html">&lt;span xmlns=''&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 78&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;11. public class Test {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;12. public void foo() {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;13. assert false;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;14. assert false;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;15. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;16. public void bar(){&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;17. while(true){&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;18. assert false;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;19. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;20. assert false;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;21. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;22. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;What causes compilation to fail?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;A. Line 13&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;B. Line 14&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;C. Line 18&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;D. Line 20&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: D&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 79&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Which statement is true?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;A. Programs will not run out of memory.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;B. Objects that will never again be used are eligible for garbage collection.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;C. Objects that are referred to by other objects will never be garbage collected.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;D. Objects that can be reached from a live thread will never be garbage collected.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;E. Objects are garbage collected immediately after the system recognizes they are&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;eligible.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: D&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 80I&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;n which two cases does the compiler supply a default constructor for class A? (Choose&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;two)&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;A. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;class A {&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;B. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;class A {&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;public A() {}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;C. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;class A {&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;public A(int x) {}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;D. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;class Z {}&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;class A extends Z {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;void A() {}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: A, D&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 81&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;1. public class ReturnIt {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;2. return Type methodA(byte x, double y) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;3. return (short)x / y * 2;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;4. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;5. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;What is the narrowest valid returnType for methodA in line2?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;A. int&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;B. byte&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;C. long&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;D. short&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;E. float&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;F. double&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: F&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 82&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;1. public class Outer{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;2. public void someOuterMethod() {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;3. // Line 3&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;4. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;5. public class Inner{}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;6. public static void main( String[]argv ) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;7. Outer o = new Outer();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;8. // Line 8&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;9. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;10. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Which instantiates an instance of Inner?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;A. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;new Inner(); // At line 3&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;B. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;new Inner(); // At line 8&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;C. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;new o.Inner(); // At line 8&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;D. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;new Outer.Inner(); // At line 8&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: A&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 83&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;What allows the programmer to destroy an object x?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;A. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;x.delete()&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;B. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;x.finalize()&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;C. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;Runtime.getRuntime().gc()&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;D. Explicitly setting the object's reference to null.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;E. Ensuring there are no references to the object.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;F. Only the garbage collection system can destroy an object.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: F&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 84&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;11. int x = 1, y =6;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;12. while (y--) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;13. x++;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;14. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;15. System.out.println("x =" + x + "y =" +y);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;What is the result?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;A. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;x = 6 y = 0&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;B. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;x = 7 y = 0&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;C. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;x = 6 y = -1&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;D. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;x = 7 y = -1&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;E. Compilation fails.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: D&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2056945240977755077-6443440350315819347?l=javacrackers.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/_iC8s17gFQ3PpFr3BpOjt7Zo708/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_iC8s17gFQ3PpFr3BpOjt7Zo708/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/_iC8s17gFQ3PpFr3BpOjt7Zo708/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_iC8s17gFQ3PpFr3BpOjt7Zo708/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/blogspot/nQxR?a=U5ZveupGef8:DQex5QuK0r4:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/blogspot/nQxR?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://javacrackers.blogspot.com/feeds/6443440350315819347/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://javacrackers.blogspot.com/2007/12/java-dumps-15-scjp.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/6443440350315819347?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/6443440350315819347?v=2" /><link rel="alternate" type="text/html" href="http://javacrackers.blogspot.com/2007/12/java-dumps-15-scjp.html" title="JAVA DUMPS 15 (SCJP)" /><author><name>gautam</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://4.bp.blogspot.com/_ACUdDpwsnW0/Sl6zJQlW8kI/AAAAAAAAAoA/d9Gu11zRf0w/s1600-R/ls_0724_twitte-gatam.JPG" /></author><thr:total>1</thr:total></entry><entry gd:etag="W/&quot;A0cHSHc-eip7ImA9WB9UFk0.&quot;"><id>tag:blogger.com,1999:blog-2056945240977755077.post-594129137937706910</id><published>2007-12-09T09:56:00.001+05:30</published><updated>2007-12-14T10:40:39.952+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-12-14T10:40:39.952+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SCJP" /><category scheme="http://www.blogger.com/atom/ns#" term="DUMPS" /><category scheme="http://www.blogger.com/atom/ns#" term="JAVA" /><title>JAVA DUMPS 14 (SCJP)</title><content type="html">&lt;span xmlns=''&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 72&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;You want subclasses in any package to have access to members of a superclass. Which is&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;the most restrictive access that accomplishes this objective?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;A. public&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;B. private&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;C. protected&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;D. transient&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;E. default access&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: C&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 73&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;1. class Exc0 extends Exception { }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;2. class Exc1 extends Exc0 { }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;3. public class Test {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;4. public static void main(String args[]) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;5. try {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;6. throw new Exc1();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;7. } catch (Exc0 e0) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;8. System.out.println("Ex0 caught");&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;9. } catch (Exception e) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;10. System.out.println("exception caught");&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;11. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;12. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;13. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;What is the result?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;A. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;Ex0 caught&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;B. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;exception caught&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;C. Compilation fails because of an error at line 2.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;D. Compilation fails because of an error at line 6.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: A&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 74&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;20. public float getSalary(Employee e) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;21. assert validEmployee(e);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;22. float sal = lookupSalary(e);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;23. assert (sal&amp;gt;0);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;24. return sal;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;25. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;26. private int getAge(Employee e) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;27. assert validEmployee(e);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;28. int age = lookupAge(e);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;29. assert (age&amp;gt;0);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;30. return age;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;31. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Which line is a violation of appropriate use of the assertion mechanism?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;A. line 21&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;B. line 23&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;C. line 27&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;D. line 29&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: A&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 75&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;1. public class A {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;2. void A() {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;3. System.out.println("Class A");&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;4. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;5. public static void main(String[] args) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;6. new A();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;7. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;8. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;What is the result?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;A. Class A&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;B. Compilation fails.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;C. An exception is thrown at line 2.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;D. An exception is thrown at line 6.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;E. The code executes with no output.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: E&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 76&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;&lt;strong&gt;Given:&lt;/strong&gt;&lt;/span&gt;&lt;span style='font-family:Arial'&gt;&lt;br /&gt;					&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;1. class Bar { }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;1. class Test {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;2. Bar doBar() {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;3. Bar b = new Bar();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;4. return b;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;5. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;6. public static void main (String args[]) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;7. Test t = new Test();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;8. Bar newBar = t.doBar();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;9. System.out.println("newBar");&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;10. newBar = new Bar();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;11. System.out.println("finishing");&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;12. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;13. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;At what point is the Bar object, created on line 3, eligible for garbage collection?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;A. After line 8.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;B. After line 10.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;C. After line 4, when doBar() completes.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;D. After line 11, when main() completes.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: C&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 77&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;1. interface Beta {}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;2.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;3. class Alpha implements Beta {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;4. String testIt() {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;5. return "Tested";&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;6. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;7. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;8.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;9. public class Main1 {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;10. static Beta getIt() {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;11. return new Alpha();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;12. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;13. public static void main( String[] args ) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;14. Beta b = getIt();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;15. System.out.println( b.testIt() );&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;16. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;17. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;What is the result?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;A. Tested&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;B. Compilation fails.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;C. The code runs with no output.&lt;/span&gt;&lt;span style='font-family:Arial'&gt;&lt;strong&gt;&lt;br /&gt;						&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: B&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2056945240977755077-594129137937706910?l=javacrackers.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/vcteL02N8dHIvXH9KRxdc1LStl4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/vcteL02N8dHIvXH9KRxdc1LStl4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/vcteL02N8dHIvXH9KRxdc1LStl4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/vcteL02N8dHIvXH9KRxdc1LStl4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/blogspot/nQxR?a=Tst1iCEFeNU:BPs1HtSSU90:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/blogspot/nQxR?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://javacrackers.blogspot.com/feeds/594129137937706910/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://javacrackers.blogspot.com/2007/12/java-dumps-14-scjp.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/594129137937706910?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/594129137937706910?v=2" /><link rel="alternate" type="text/html" href="http://javacrackers.blogspot.com/2007/12/java-dumps-14-scjp.html" title="JAVA DUMPS 14 (SCJP)" /><author><name>gautam</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://4.bp.blogspot.com/_ACUdDpwsnW0/Sl6zJQlW8kI/AAAAAAAAAoA/d9Gu11zRf0w/s1600-R/ls_0724_twitte-gatam.JPG" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;A0cHSHc-eip7ImA9WB9UFk0.&quot;"><id>tag:blogger.com,1999:blog-2056945240977755077.post-926438353151491602</id><published>2007-12-06T17:33:00.001+05:30</published><updated>2007-12-14T10:40:39.952+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-12-14T10:40:39.952+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SCJP" /><category scheme="http://www.blogger.com/atom/ns#" term="DUMPS" /><category scheme="http://www.blogger.com/atom/ns#" term="JAVA" /><title>JAVA DUMPS 13(SCJP)</title><content type="html">&lt;span xmlns=''&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;1. class Super {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;2. public int i = 0;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;3.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;4. public Super(String text) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;5. i = 1;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;6. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;7. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;8.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;9. public class Sub extends Super {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;10. public Sub(String text) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;11. i = 2;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;12. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;13.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;14. public static void main(String args[]) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;15. Sub sub = new Sub("Hello");&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;16. System.out.println(sub.i);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;17. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;18. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;What is the result?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;A. 0&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;B. 1&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;C. 2&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;D. Compilation fails.&lt;/span&gt;&lt;span style='font-family:Arial'&gt;&lt;strong&gt;&lt;br /&gt;						&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: D&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 68&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;11. int i = 1,j = 10;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;12. do{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;13. if (i&amp;gt;j) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;14. continue;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;15. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;16. j--;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;17. } while (++i &amp;lt;6);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;18. System.out.println("i = " +i+" and j = "+j);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;What is the result?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;A. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;i = 6 and j = 5&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;B. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;i = 5 and j = 5&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;C. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;i = 6 and j = 4&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;D. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;i = 5 and j = 6&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;E. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;i = 6 and j = 6&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: D&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 69&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Which fragment is an example of inappropriate use of assertions?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;A. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;assert (!(map.contains(x)));&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;map.add(x);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;B. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;if (x &amp;gt; 0) {&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;} else {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;assert (x==0);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;C. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;public void aMethod(int x) {&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;assert (x &amp;gt; 0);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;D. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;assert (invariantCondition());&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;return retval;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;E. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;switch (x) {&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;case 1: break;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;case 2: creak;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;default: assert (x == 0);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: C&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 70&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;1. public class X {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;2. public X aMethod() { return this;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;3. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;1. public class Y extends X {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;2.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;3. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Which two methods can be added to the definition of class Y? (Choose two)&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;A. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;public void aMethod() {}&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;B. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;private void aMethod() {}&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;C. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;public void aMethod(String s) {}&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;D. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;private Y aMethod() { return null; }&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;E. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;public X aMethod() { return new Y(); }&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: C, E&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 71&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;1. public class X {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;2. public static void main(String [] args) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;3. try {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;4. badMethod();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;5. System.out.print("A");&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;6. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;7. catch (Exception ex) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;8. System.out.print("B");&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;9. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;10. finally {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;11. System.out.print("B");&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;12. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;13. System.out.print("D");&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;14. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;15. public static void badMethod() {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;16. throw new Error();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;17. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;18. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;What is the result?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;A. ABCD&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;B. Compilation fails.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;C. C is printed before exiting with an error message.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;D. BC is printed before exiting with an error message. &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;E. BCD is printed before exiting with an error message.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: C&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2056945240977755077-926438353151491602?l=javacrackers.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/OJ9BHW6Nh-j1zUgL_GxKSMCN4mA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/OJ9BHW6Nh-j1zUgL_GxKSMCN4mA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/OJ9BHW6Nh-j1zUgL_GxKSMCN4mA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/OJ9BHW6Nh-j1zUgL_GxKSMCN4mA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/blogspot/nQxR?a=m_XwdlRLiAQ:zOilADwZ0iU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/blogspot/nQxR?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://javacrackers.blogspot.com/feeds/926438353151491602/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://javacrackers.blogspot.com/2007/12/java-dumps-13scjp.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/926438353151491602?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/926438353151491602?v=2" /><link rel="alternate" type="text/html" href="http://javacrackers.blogspot.com/2007/12/java-dumps-13scjp.html" title="JAVA DUMPS 13(SCJP)" /><author><name>gautam</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://4.bp.blogspot.com/_ACUdDpwsnW0/Sl6zJQlW8kI/AAAAAAAAAoA/d9Gu11zRf0w/s1600-R/ls_0724_twitte-gatam.JPG" /></author><thr:total>3</thr:total></entry><entry gd:etag="W/&quot;CEIBRXczcSp7ImA9WB9VFEQ.&quot;"><id>tag:blogger.com,1999:blog-2056945240977755077.post-8886965506751211078</id><published>2007-12-01T12:31:00.000+05:30</published><updated>2007-12-01T12:32:34.989+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-12-01T12:32:34.989+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SCJP" /><category scheme="http://www.blogger.com/atom/ns#" term="tutorial" /><category scheme="http://www.blogger.com/atom/ns#" term="JAVA" /><title>ANONYMOUS CLASSES</title><content type="html">&lt;p&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;b&gt;Anonymous classes can be declared  to extend another class or to implement a single interface&lt;/b&gt;. If you  declare a class that implements a single explicit interface, then it  is a direct subclass of java.lang.Object. &lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Anonymous classes give you a convenient  way to avoid having to think up trivial names for classes. They should  be small and easy to understand as they do not contain descriptive names. &lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;You cannot define any specific constructor  for an anonymous inner class. This is a direct consequence of the fact  that you do not specify a name for the class, and therefore you cannot  use that name to specify a constructor. Anonymous Class Declarations &lt;/span&gt;&lt;/p&gt; &lt;p&gt;      &lt;span style="font-family:Courier New;font-size:130%;"&gt;new  Identifier() { /* class body */ }&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Identifier is a class or interface  name. The expression by itself isn't of much use, it returns a reference  to an object that you usually assign to a reference variable of the  same type of the identifier: &lt;/span&gt;&lt;/p&gt; &lt;p&gt;      &lt;span style="font-family:Courier New;font-size:130%;"&gt;Identifier  = new Identifier() { /* class body */ };&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Of course you can also pass the resulting  reference to a method: &lt;/span&gt;&lt;/p&gt; &lt;p&gt;      &lt;span style="font-family:Courier New;font-size:130%;"&gt;Method(new  Identifier() { /* class body *} );&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Example: &lt;/span&gt;&lt;/p&gt; &lt;p&gt;      &lt;span style="font-family:Courier New;font-size:130%;"&gt;class  Test {&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;public static void main(String args[])  {&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;                  &lt;span style="font-family:Courier New;font-size:130%;"&gt;Base o = new Base() { &lt;/span&gt;&lt;/p&gt; &lt;p&gt;                        &lt;span style="font-family:Courier New;font-size:130%;"&gt;public void Hi() {&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                              &lt;span style="font-family:Courier New;font-size:130%;"&gt;System.out.println("Hi!");&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                        &lt;span style="font-family:Courier New;font-size:130%;"&gt;}&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                        &lt;span style="font-family:Courier New;font-size:130%;"&gt;public void Bye() {&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                              &lt;span style="font-family:Courier New;font-size:130%;"&gt;System.out.println("Bye");&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                        &lt;span style="font-family:Courier New;font-size:130%;"&gt;}&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                  &lt;span style="font-family:Courier New;font-size:130%;"&gt;};&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;                  &lt;span style="font-family:Courier New;font-size:130%;"&gt;o.Hi();&lt;/span&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;      &lt;span style="font-family:Courier New;font-size:130%;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;      &lt;span style="font-family:Courier New;font-size:130%;"&gt;interface  Base {&lt;/span&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;public void Hi();&lt;/span&gt;&lt;/p&gt; &lt;p&gt;      &lt;span style="font-family:Courier New;font-size:130%;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;      &lt;span style="font-family:Courier New;font-size:130%;"&gt;&lt;b&gt;Result:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;Hi!&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Anonymous classes should provide methods  defined by the base class or the interface but not brand new methods  although they can be declared without compilation errors. &lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Verdana;font-size:130%;"&gt;&lt;b&gt;Passing arguments&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;You can define a constructor inside  a inner class, but if you provide arguments, the matching constructor  of base class will be invoked: &lt;/span&gt;&lt;/p&gt; &lt;p&gt;      &lt;span style="font-family:Courier New;font-size:130%;"&gt;class  Test {&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;public static void main(String args[])  {&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;                  &lt;span style="font-family:Courier New;font-size:130%;"&gt;Base o = new Base(15) { &lt;/span&gt;&lt;/p&gt; &lt;p&gt;                        &lt;span style="font-family:Courier New;font-size:130%;"&gt;public void Hi() {&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                              &lt;span style="font-family:Courier New;font-size:130%;"&gt;System.out.println("Hi!");&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                        &lt;span style="font-family:Courier New;font-size:130%;"&gt;}&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                        &lt;span style="font-family:Courier New;font-size:130%;"&gt;public void Bye() {&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                              &lt;span style="font-family:Courier New;font-size:130%;"&gt;System.out.println("Bye");&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                        &lt;span style="font-family:Courier New;font-size:130%;"&gt;}&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                  &lt;span style="font-family:Courier New;font-size:130%;"&gt;};&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;                  &lt;span style="font-family:Courier New;font-size:130%;"&gt;o.Hi();&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                  &lt;span style="font-family:Courier New;font-size:130%;"&gt;// o.Bye(); // ERROR. &lt;/span&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;}&lt;/span&gt;&lt;/p&gt; &lt;p&gt;      &lt;span style="font-family:Courier New;font-size:130%;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;      &lt;span style="font-family:Courier New;font-size:130%;"&gt;class  Base {&lt;/span&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;Base (int i) {&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                  &lt;span style="font-family:Courier New;font-size:130%;"&gt;System.out.println("I've got "+i);&lt;/span&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;}&lt;/span&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;public void Hi() { }&lt;/span&gt;&lt;/p&gt; &lt;p&gt;      &lt;span style="font-family:Courier New;font-size:130%;"&gt;}&lt;/span&gt;&lt;/p&gt; &lt;p&gt;      &lt;span style="font-family:Courier New;font-size:130%;"&gt;&lt;b&gt;Result:&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;I've got 15&lt;/span&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;Hi!&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Verdana;font-size:130%;"&gt;&lt;b&gt;Initialising Anonymous classes&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;You can't define constructors for an  anonymous class, but you can declare an initialisation block: &lt;/span&gt;&lt;/p&gt; &lt;p&gt;      &lt;span style="font-family:Courier New;font-size:130%;"&gt;class  Test {&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;public static void main(String args[])  {&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                  &lt;span style="font-family:Courier New;font-size:130%;"&gt;Object o = new Object() { &lt;/span&gt;&lt;/p&gt; &lt;p&gt;                        &lt;span style="font-family:Courier New;font-size:130%;"&gt;{&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                              &lt;span style="font-family:Courier New;font-size:130%;"&gt;System.out.println("Init");&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                        &lt;span style="font-family:Courier New;font-size:130%;"&gt;}&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                  &lt;span style="font-family:Courier New;font-size:130%;"&gt;};&lt;/span&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;}&lt;/span&gt;&lt;/p&gt; &lt;p&gt;      &lt;span style="font-family:Courier New;font-size:130%;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;      &lt;span style="font-family:Courier New;font-size:130%;"&gt;&lt;b&gt;Result:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;Init&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;This feature is available to all classes,  not only anonymous ones. &lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2056945240977755077-8886965506751211078?l=javacrackers.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ddXGzGwqLbuUPEeZlhwGvhlUgjg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ddXGzGwqLbuUPEeZlhwGvhlUgjg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/ddXGzGwqLbuUPEeZlhwGvhlUgjg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ddXGzGwqLbuUPEeZlhwGvhlUgjg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/blogspot/nQxR?a=cnz-DhPRb3s:1sAwcQN6uis:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/blogspot/nQxR?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://javacrackers.blogspot.com/feeds/8886965506751211078/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://javacrackers.blogspot.com/2007/11/anonymous-classes.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/8886965506751211078?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/8886965506751211078?v=2" /><link rel="alternate" type="text/html" href="http://javacrackers.blogspot.com/2007/11/anonymous-classes.html" title="ANONYMOUS CLASSES" /><author><name>gautam</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://4.bp.blogspot.com/_ACUdDpwsnW0/Sl6zJQlW8kI/AAAAAAAAAoA/d9Gu11zRf0w/s1600-R/ls_0724_twitte-gatam.JPG" /></author><thr:total>1</thr:total></entry><entry gd:etag="W/&quot;CEMMR349eyp7ImA9WB9VFEQ.&quot;"><id>tag:blogger.com,1999:blog-2056945240977755077.post-4316058386594710523</id><published>2007-12-01T12:27:00.000+05:30</published><updated>2007-12-01T12:31:26.063+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-12-01T12:31:26.063+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SCJP" /><category scheme="http://www.blogger.com/atom/ns#" term="tutorial" /><category scheme="http://www.blogger.com/atom/ns#" term="JAVA" /><title>INNER CLASSES</title><content type="html">&lt;p&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;b&gt;An inner or nested class is the  same as any other class but is declared inside some other class or method.&lt;/b&gt;  When an instance of an inner class is created, there must normally be  a pre-existing instance of the outer class acting as context. An inner  class and an outer class belong together; the inner class is not just  another member of the outer instance. &lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;b&gt;Example #1:&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;      &lt;span style="font-family:Courier New;font-size:130%;"&gt;class  Test {&lt;/span&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;class Inner {&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                  &lt;span style="font-family:Courier New;font-size:130%;"&gt;Inner () {&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                        &lt;span style="font-family:Courier New;font-size:130%;"&gt;System.out.println("Hello World");&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                  &lt;span style="font-family:Courier New;font-size:130%;"&gt;}&lt;/span&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;public static void main(String args[])  {&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                  &lt;span style="font-family:Courier New;font-size:130%;"&gt;Test.Inner i = new Test().new Inner();&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;}&lt;/span&gt;&lt;/p&gt; &lt;p&gt;      &lt;span style="font-family:Courier New;font-size:130%;"&gt;}&lt;/span&gt;&lt;/p&gt; &lt;p&gt;      &lt;span style="font-family:Courier New;font-size:130%;"&gt;&lt;b&gt;Result:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;Hello World&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Please note the special syntax used  to reference the Inner class from a static context. This is just a shorter  approach for this:&lt;/span&gt;&lt;/p&gt; &lt;p&gt;      &lt;span style="font-family:Courier New;font-size:130%;"&gt;Test  t = new Test();&lt;/span&gt;&lt;/p&gt; &lt;p&gt;      &lt;span style="font-family:Courier New;font-size:130%;"&gt;Inner  i = t.new Inner();&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;b&gt;Example #2:&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;      &lt;span style="font-family:Courier New;font-size:130%;"&gt;class  Test {&lt;/span&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;String h = "Hello World";&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;class Inner {&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                  &lt;span style="font-family:Courier New;font-size:130%;"&gt;Inner () {&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                        &lt;span style="font-family:Courier New;font-size:130%;"&gt;System.out.println(h);&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                        &lt;span style="font-family:Courier New;font-size:130%;"&gt;Bye();&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                  &lt;span style="font-family:Courier New;font-size:130%;"&gt;}&lt;/span&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;public static void main(String args[])  {&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                  &lt;span style="font-family:Courier New;font-size:130%;"&gt;Test.Inner i = new Test().new Inner();&lt;/span&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;void Bye() {&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                  &lt;span style="font-family:Courier New;font-size:130%;"&gt;System.out.println("Good bye!");&lt;/span&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;}&lt;/span&gt;&lt;/p&gt; &lt;p&gt;      &lt;span style="font-family:Courier New;font-size:130%;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;      &lt;span style="font-family:Courier New;font-size:130%;"&gt;&lt;b&gt;Result:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;Hello World&lt;/span&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;Bye&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;b&gt;Inner classes have access to all  the features of the outer class including also methods. &lt;/b&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Verdana;font-size:130%;"&gt;&lt;b&gt;Access modifiers and Static Inner  Classes&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Inner classes may be marked with standard  access modifiers (private, public, protected) (or default if no modifier  is specified). Static inner classes do not have any reference to the  enclosing instance. &lt;b&gt;Static methods of inner classes may not access  non-static features of the outer class&lt;/b&gt;. &lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;b&gt;Example: &lt;/b&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;      &lt;span style="font-family:Courier New;font-size:130%;"&gt;class  Test {&lt;/span&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;private static String h = "Hello World";&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;static class Inner {&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                  &lt;span style="font-family:Courier New;font-size:130%;"&gt;static void MyMethod () {&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                        &lt;span style="font-family:Courier New;font-size:130%;"&gt;System.out.println(h);&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                  &lt;span style="font-family:Courier New;font-size:130%;"&gt;}&lt;/span&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;public static void main(String args[])  {&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                  &lt;span style="font-family:Courier New;font-size:130%;"&gt;Test.Inner.MyMethod();&lt;/span&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;      &lt;span style="font-family:Courier New;font-size:130%;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;      &lt;span style="font-family:Courier New;font-size:130%;"&gt;&lt;b&gt;Result:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;Hello World&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;The Inner class is an extension of  the outer class, so we have access to private members. &lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Verdana;font-size:130%;"&gt;&lt;b&gt;Classes defined inside Methods&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Anything declared inside a method is  not a member of the class but is local to the method. Therefore, classes  declared in methods are private to the method and cannot be marked with  any access modifier; neither can they be marked as static. However,  an object created from an inner class within a method can have some  access to the variables of the enclosing method if they declare the  final modifier. &lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Since local variables and method arguments  are conventionally destroyed when their method exits, these variables  would be invalid for access by inner class methods after the enclosing  method exists. By allowing access only to final variables, it becomes  possible to copy the values of those variables into the object itself. &lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;b&gt;Example:&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;      &lt;span style="font-family:Courier New;font-size:130%;"&gt;class  Test {&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;public static void main(String args[])  {&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                  &lt;span style="font-family:Courier New;font-size:130%;"&gt;Hi("Ernest");&lt;/span&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;static void Hi(String name) {&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;                  &lt;span style="font-family:Courier New;font-size:130%;"&gt;final String h = "Hello World "  + name;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                  &lt;span style="font-family:Courier New;font-size:130%;"&gt;int j = 5;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;                  &lt;span style="font-family:Courier New;font-size:130%;"&gt;class Inner {&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                        &lt;span style="font-family:Courier New;font-size:130%;"&gt;void MyMethod () {&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                              &lt;span style="font-family:Courier New;font-size:130%;"&gt;System.out.println(h);&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                              &lt;span style="font-family:Courier New;font-size:130%;"&gt;// j++; // ERROR !!!&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                        &lt;span style="font-family:Courier New;font-size:130%;"&gt;}&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                  &lt;span style="font-family:Courier New;font-size:130%;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;                  &lt;span style="font-family:Courier New;font-size:130%;"&gt;Inner i = new Inner();&lt;/span&gt;&lt;/p&gt; &lt;p&gt;                  &lt;span style="font-family:Courier New;font-size:130%;"&gt;i.MyMethod();&lt;/span&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-family:Courier New;font-size:130%;"&gt;} &lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;      &lt;span style="font-family:Courier New;font-size:130%;"&gt;}&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Although the variable name entered  the method as normal variable, its contents were added to a final variable. &lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;a name="0.1_01000004"&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2056945240977755077-4316058386594710523?l=javacrackers.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/l8atkCzFDaLoAI4F8hSYHe6Lf24/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/l8atkCzFDaLoAI4F8hSYHe6Lf24/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/l8atkCzFDaLoAI4F8hSYHe6Lf24/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/l8atkCzFDaLoAI4F8hSYHe6Lf24/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/blogspot/nQxR?a=GO124k0BCls:fsS3NpvPDRQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/blogspot/nQxR?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://javacrackers.blogspot.com/feeds/4316058386594710523/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://javacrackers.blogspot.com/2007/11/inner-classes.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/4316058386594710523?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/4316058386594710523?v=2" /><link rel="alternate" type="text/html" href="http://javacrackers.blogspot.com/2007/11/inner-classes.html" title="INNER CLASSES" /><author><name>gautam</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://4.bp.blogspot.com/_ACUdDpwsnW0/Sl6zJQlW8kI/AAAAAAAAAoA/d9Gu11zRf0w/s1600-R/ls_0724_twitte-gatam.JPG" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CEUCQ3k8eSp7ImA9WB9VFEQ.&quot;"><id>tag:blogger.com,1999:blog-2056945240977755077.post-5634787796929383339</id><published>2007-12-01T12:26:00.001+05:30</published><updated>2007-12-01T12:27:42.771+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-12-01T12:27:42.771+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SCJP" /><category scheme="http://www.blogger.com/atom/ns#" term="tutorial" /><category scheme="http://www.blogger.com/atom/ns#" term="JAVA" /><title>OVERLOADING CONSTRUCTORS 2</title><content type="html">&lt;p class="MsoNormal" style=""&gt;&lt;b&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Example #5:&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;class Test {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;public static void main(String args[]) {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Reptile r = new Reptile(4);&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;class Animal {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;int legs = 0;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;boolean cold_blood = false;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Animal (int l) {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;legs = l;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;System.out.println("Animal constructor - leg argument");&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;class Reptile extends Animal {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Reptile (int l) {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;super(l);&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;System.out.println("Reptile constructor - leg argument");&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}  &lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;b&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Result:&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Animal constructor - leg argument&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Reptile constructor - leg argument&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;If the Reptile class hasn't the Reptile (int l) constructor it wouldn't be possible to initialise it with that argument as constructors are not inherited as methods. Something like this would also be invalid: &lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Reptile r = new Reptile();&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Animal a = new Animal();&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Animal() and Reptile() aren't defined. Java doesn't supply default constructors because one is already defined. &lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Because of this special behavior you must take special care with this() because a super() call is produced automatically: &lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;b&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Example #6:&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;class Test {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;public static void main(String args[]) {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Reptile r = new Reptile(4);&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;class Animal {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;int legs = 0;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;boolean cold_blood = false;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Animal (int l) {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;legs = l;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;System.out.println("Animal constructor - leg argument");&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Animal (boolean b) {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;cold_blood = b;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;System.out.println("Animal constructor - blood argument");&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;class Reptile extends Animal {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Reptile (int l) {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;this(true);     // WATCH OUT!!!&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;System.out.println("Reptile constructor - leg argument");&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}  &lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Reptile (boolean b) {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;cold_blood = b;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;System.out.println("Reptile constructor - blood argument");&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;b&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Result:&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;ERROR. constructor Animal () not found&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;There are two ways to solve this problem, we can add a Animal() constructor, or we can make sure that the proper Animal constructor gets called, like this: &lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;b&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Example #7:&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;class Test {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;public static void main(String args[]) {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Reptile r = new Reptile(4);&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;class Animal {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;int legs = 0;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;boolean cold_blood = false;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Animal (int l) {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;legs = l;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;System.out.println("Animal constructor - leg argument");&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Animal (boolean b) {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;cold_blood = b;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;System.out.println("Animal constructor - blood argument");&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;class Reptile extends Animal {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Reptile (int l) {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;this(true);&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;System.out.println("Reptile constructor - leg argument");&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}  &lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Reptile (boolean b) {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;super(b);&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;System.out.println("Reptile constructor - blood argument");&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;You have to understand that each parent class will be initialised somehow and you must tell Java which constructors should be used if you don't want Java to insist on calling the default constructor all the time. &lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;b&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;So, do not forget:&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;In      a hierarchy of classes, Java calls the default constructor of each parent      class before the body of the current constructor is executed. You cannot      prevent Java from calling a constructor for each class but you can tell      Java which constructor should be chosen by the parent class using the      super() keyword. &lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Java      provides a default constructor for each class if NO CONSTRUCTOR is defined      by the programmer. If just one constructor is defined, Java doesn't put up      a default constructor anymore. &lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Constructors      are not inherited, you must define all the constructors again or reuse the      functionality of a parent constructor using super(). &lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2056945240977755077-5634787796929383339?l=javacrackers.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ADtYNWP5nzOVG_toQnRtJTkju4E/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ADtYNWP5nzOVG_toQnRtJTkju4E/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/ADtYNWP5nzOVG_toQnRtJTkju4E/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ADtYNWP5nzOVG_toQnRtJTkju4E/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/blogspot/nQxR?a=WHVmbJUXB-o:zRY1a4v9ngs:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/blogspot/nQxR?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://javacrackers.blogspot.com/feeds/5634787796929383339/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://javacrackers.blogspot.com/2007/11/overloading-constructors-2.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/5634787796929383339?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/5634787796929383339?v=2" /><link rel="alternate" type="text/html" href="http://javacrackers.blogspot.com/2007/11/overloading-constructors-2.html" title="OVERLOADING CONSTRUCTORS 2" /><author><name>gautam</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://4.bp.blogspot.com/_ACUdDpwsnW0/Sl6zJQlW8kI/AAAAAAAAAoA/d9Gu11zRf0w/s1600-R/ls_0724_twitte-gatam.JPG" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CEYMRH08eyp7ImA9WB9VFEQ.&quot;"><id>tag:blogger.com,1999:blog-2056945240977755077.post-1838020837958567433</id><published>2007-12-01T12:25:00.000+05:30</published><updated>2007-12-01T12:26:25.373+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-12-01T12:26:25.373+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SCJP" /><category scheme="http://www.blogger.com/atom/ns#" term="tutorial" /><category scheme="http://www.blogger.com/atom/ns#" term="JAVA" /><title>OVERLOADING CONSTRUCTORS 1</title><content type="html">&lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Overloading constructors behave just like overloading methods. When you have different constructors and want to call one version from another, you use the keyword this. &lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;b&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Example:&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;class Test {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;public static void main(String args[]) {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Animal d = new Animal(true);&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;System.out.println("Legs: "+ d.legs);&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;System.out.println("Mammal: "+ d.mammal);&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;System.out.println("Vertebrate: "+ d.vertebrate);&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;class Animal {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;int legs = 0;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;boolean mammal = false;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;boolean vertebrate = false;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;br /&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Animal (int l, boolean m, boolean v) {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;legs = l;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;mammal = m;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;vertebrate = v;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;System.out.println("Animal constructor - all arguments");&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Animal (boolean m) {       &lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;this(4,m,true);  &lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;System.out.println("Animal constructor - mammal argument");&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;b&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Result:&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Animal constructor - all arguments&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Animal constructor - mammal argument&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Legs: 4&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Mammal: true&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Vertebrate: true&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;The &lt;b&gt;keyword this must also be the first sentence of the constructor.&lt;/b&gt; Thus &lt;b&gt;you can't use super() and this() at the same time in the same constructor&lt;/b&gt;. However, super() is implicitly called even if you don't use it because the parents of the class are always initialised first and before the body of the constructor. &lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;b&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Example #1:&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;class Test {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;public static void main(String args[]) {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Reptile r = new Reptile(4);&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;class Animal {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;int legs = 0;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;boolean cold_blood = false;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;class Reptile extends Animal {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Reptile (int l) {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;legs = l;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;System.out.println("Reptile constructor - leg argument");&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}  &lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;b&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Result:&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Reptile constructor - leg argument&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;The compiler calls the default constructor for Animal and then the argument version of Reptile. Let's define our own default constructor just to be sure. &lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;b&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Example #2:&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;class Test {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;public static void main(String args[]) {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Reptile r = new Reptile(4);&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;class Animal {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;int legs = 0;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;boolean cold_blood = false;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Animal() {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;System.out.println("Animal constructor - default");&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;class Reptile extends Animal {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Reptile (int l) {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;legs = l;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;System.out.println("Reptile constructor - leg argument");&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}  &lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;b&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Result:&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Animal constructor - default&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Reptile constructor - leg argument&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Oops! We should also be able to define the number of legs for all animals, not only reptiles. &lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;b&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Example #3:&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;class Test {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;public static void main(String args[]) {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Reptile r = new Reptile(4);&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;class Animal {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;int legs = 0;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;boolean cold_blood = false;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Animal() {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;System.out.println("Animal constructor - default");&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Animal (int l) {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;legs = l;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;System.out.println("Animal constructor - leg argument");&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;class Reptile extends Animal {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Reptile (int l) {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;legs = l;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;System.out.println("Reptile constructor - leg argument");&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}  &lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;b&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Results:&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Animal constructor - default&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Reptile constructor - leg argument&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Java keeps calling the default constructor. If we take it out maybe Java will try to use the remaining method Animal (int l): &lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;b&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Example #4:&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;class Test {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;public static void main(String args[]) {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Reptile r = new Reptile(4);&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;class Animal {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;int legs = 0;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;boolean cold_blood = false;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Animal (int l) {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;legs = l;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;System.out.println("Animal constructor - leg argument");&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;class Reptile extends Animal {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Reptile (int l) {&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;legs = l;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;                  &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;System.out.println("Reptile constructor - leg argument");&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}  &lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;      &lt;/span&gt;&lt;b&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Result:&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;            &lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;ERROR. constructor Animal () not found&lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;So what happened?. We have said before that if at least one constructor is defined, Java doesn't provide one by default. The error occurs because Reptile(int l) will call Animal() before the body of the constructor is executed as if a super() was there. We don't need to get back to our Animal() constructor. We only need to customize super() which is currently implicit: &lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2056945240977755077-1838020837958567433?l=javacrackers.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/TLOkhg5uwxYQmNvr5rL4tLbavXU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/TLOkhg5uwxYQmNvr5rL4tLbavXU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/TLOkhg5uwxYQmNvr5rL4tLbavXU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/TLOkhg5uwxYQmNvr5rL4tLbavXU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/blogspot/nQxR?a=bCmbDsyE_Xg:ZmO-gxaSNEQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/blogspot/nQxR?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://javacrackers.blogspot.com/feeds/1838020837958567433/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://javacrackers.blogspot.com/2007/11/overloading-constructors-1.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/1838020837958567433?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/1838020837958567433?v=2" /><link rel="alternate" type="text/html" href="http://javacrackers.blogspot.com/2007/11/overloading-constructors-1.html" title="OVERLOADING CONSTRUCTORS 1" /><author><name>gautam</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://4.bp.blogspot.com/_ACUdDpwsnW0/Sl6zJQlW8kI/AAAAAAAAAoA/d9Gu11zRf0w/s1600-R/ls_0724_twitte-gatam.JPG" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CEcMQ38zeip7ImA9WB9VFEQ.&quot;"><id>tag:blogger.com,1999:blog-2056945240977755077.post-5211132886592707228</id><published>2007-12-01T12:22:00.000+05:30</published><updated>2007-12-01T12:24:42.182+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-12-01T12:24:42.182+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SCJP" /><category scheme="http://www.blogger.com/atom/ns#" term="tutorial" /><category scheme="http://www.blogger.com/atom/ns#" term="JAVA" /><title>CONSTRUCTORS AND SUBCLASSING</title><content type="html">Constructors are not inherited into subclasses; you must define each form of constructor that you require. A class constructor that has no constructors defined in the source is given exactly one constructor. This is the default constructor; it takes no arguments and is of public accessibility&lt;br /&gt;Java insists that the object is initialized from the top of the class hierarchy downward:&lt;br /&gt;Example:&lt;br /&gt;     class Test {&lt;br /&gt;           static int i = 0;&lt;br /&gt;           public static void main(String args[]) {&lt;br /&gt;                 Terrier t = new Terrier(15);&lt;br /&gt;                 System.out.println("Count: "+ i);&lt;br /&gt;           }&lt;br /&gt;     }&lt;br /&gt;     class Animal {&lt;br /&gt;           Animal (int increment) {&lt;br /&gt;                 Test.i += increment;&lt;br /&gt;                 System.out.println("Animal constructor");&lt;br /&gt;           }&lt;br /&gt;     }&lt;br /&gt;     class Dog extends Animal {&lt;br /&gt;           Dog (int increment) {&lt;br /&gt;                 super(increment);&lt;br /&gt;                 Test.i += increment;&lt;br /&gt;                 System.out.println("Dog constructor");&lt;br /&gt;           }&lt;br /&gt;     }&lt;br /&gt;     class Terrier extends Dog {&lt;br /&gt;           Terrier (int increment) {&lt;br /&gt;                 super(increment);&lt;br /&gt;                 Test.i += increment;&lt;br /&gt;                 System.out.println("Terrier constructor");&lt;br /&gt;           }&lt;br /&gt;     }&lt;br /&gt;     Result:&lt;br /&gt;           Animal constructor&lt;br /&gt;           Dog constructor&lt;br /&gt;           Terrier constructor&lt;br /&gt;           Count: 45&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Calling Superclass Constructors &lt;/span&gt;&lt;br /&gt;In the case of constructors you also use the keyword super() as with plain methods but you don't actually need to supply the name of the constructor, just super(arguments).&lt;br /&gt;Example:&lt;br /&gt;     class Test {&lt;br /&gt;           public static void main(String args[]) {&lt;br /&gt;                 Dog d = new Dog();&lt;br /&gt;                 Animal a = new Animal(); //     ERROR. No constructor&lt;br /&gt;                 System.out.println("Legs: "+ d.legs);&lt;br /&gt;                 System.out.println("Mammal: "+ d.mammal);&lt;br /&gt;                 System.out.println("Vertebrate: "+ d.vertebrate);&lt;br /&gt;           }&lt;br /&gt;     }&lt;br /&gt;     class Animal {&lt;br /&gt;           int legs = 0;&lt;br /&gt;           boolean mammal = false;&lt;br /&gt;           boolean vertebrate = false;&lt;br /&gt;           Animal (int l, boolean m, boolean v) {&lt;br /&gt;                 legs = l;&lt;br /&gt;                 mammal = m;&lt;br /&gt;                 vertebrate = v;&lt;br /&gt;                 System.out.println("Animal constructor");&lt;br /&gt;           }&lt;br /&gt;     }&lt;br /&gt;     class Dog extends Animal {&lt;br /&gt;           Dog () {&lt;br /&gt;                 super(4,true,true);&lt;br /&gt;                 System.out.println("Dog constructor");&lt;br /&gt;           }&lt;br /&gt;     }&lt;br /&gt;     Result:&lt;br /&gt;           Animal constructor&lt;br /&gt;           Dog constructor&lt;br /&gt;           Legs: 4&lt;br /&gt;           Mammal: true&lt;br /&gt;           Vertebrate: true&lt;br /&gt;As you can see, if you provide a valid constructor, Java doesn't generate a default constructor anymore. To make the erroneous line valid, you should add the constructor to the Animal class:&lt;br /&gt;     Animal() {}&lt;br /&gt;That also means that if you define a argument-based constructor in the superclass, you won't be able to create non-argument objects out of any of the subclasses. For example, suppose you want to add a Bird class to the previous example:&lt;br /&gt;     class Bird extends Animal {&lt;br /&gt;           Bird() {&lt;br /&gt;                 System.out.println("Bird constructor");&lt;br /&gt;           }&lt;br /&gt;     }&lt;br /&gt;You have to define Animal() {} in the Animal if you want to use this new class like this:&lt;br /&gt;     Bird b = new Bird();&lt;br /&gt;This happens because Java will try to call Animal() before calling Bird(), and Animal() hasn't been defined. You can specify which constructor of the superclass will be called by using super:&lt;br /&gt;     class Bird extends Animal {&lt;br /&gt;           Bird() {&lt;br /&gt;                 super(2,false,true);&lt;br /&gt;                 System.out.println("Bird constructor");&lt;br /&gt;           }&lt;br /&gt;     }&lt;br /&gt;Please note that super() must be the first statement in the Bird() constructor in order to be recognized by the compiler.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2056945240977755077-5211132886592707228?l=javacrackers.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/mPAnS-Yg6D2a12yBMbpcWOrwkK8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/mPAnS-Yg6D2a12yBMbpcWOrwkK8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/mPAnS-Yg6D2a12yBMbpcWOrwkK8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/mPAnS-Yg6D2a12yBMbpcWOrwkK8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/blogspot/nQxR?a=iQnbNeeOUho:miVJbwXO0ww:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/blogspot/nQxR?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://javacrackers.blogspot.com/feeds/5211132886592707228/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://javacrackers.blogspot.com/2007/11/constructors-and-subclassing.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/5211132886592707228?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/5211132886592707228?v=2" /><link rel="alternate" type="text/html" href="http://javacrackers.blogspot.com/2007/11/constructors-and-subclassing.html" title="CONSTRUCTORS AND SUBCLASSING" /><author><name>gautam</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://4.bp.blogspot.com/_ACUdDpwsnW0/Sl6zJQlW8kI/AAAAAAAAAoA/d9Gu11zRf0w/s1600-R/ls_0724_twitte-gatam.JPG" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;C04GQXY8fip7ImA9WB9VFEQ.&quot;"><id>tag:blogger.com,1999:blog-2056945240977755077.post-3540674090310952226</id><published>2007-12-01T12:20:00.000+05:30</published><updated>2007-12-01T12:22:00.876+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-12-01T12:22:00.876+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SCJP" /><category scheme="http://www.blogger.com/atom/ns#" term="tutorial" /><category scheme="http://www.blogger.com/atom/ns#" term="JAVA" /><title>OVERRIDING</title><content type="html">When you extend a class to produce a new one, you inherit and have access to all the non-private methods of the original class. When you want to redefine the behavior of one of these methods to suit your new class, you override the method to define a new one. &lt;br /&gt;An overriding method replaces the method it overrides. Each method in a parent class can be overridden at most once in any subclass. Overriding methods should have argument lists of identical type and order. The return type of an overriding method must be identical to that of the method it overrides. &lt;br /&gt;Some other special rules apply to overriding methods:&lt;br /&gt;• The accessibility must not be more restricted than the original method &lt;br /&gt;• The method must not throw checked exceptions of classes that are not possible for the original method. &lt;br /&gt;Example #1:&lt;br /&gt;      class Animal {&lt;br /&gt;            void saySomething() {&lt;br /&gt;                  System.out.println("Our kind is unable to speak");&lt;br /&gt;            }&lt;br /&gt;      } &lt;br /&gt;      class Dog extends Animal {&lt;br /&gt;            void saySomething() {&lt;br /&gt;                  System.out.println("Wof!");&lt;br /&gt;            } &lt;br /&gt;      } &lt;br /&gt;      Animal a[] = new Animal[2];&lt;br /&gt;      a[0] = new Animal();&lt;br /&gt;      a[1] = new Dog(); &lt;br /&gt;      a[0].saySomething();&lt;br /&gt;      a[1].saySomething(); &lt;br /&gt;      Result: &lt;br /&gt;      Our kind is unable to speak&lt;br /&gt;      Wof!&lt;br /&gt;Invoking Overridden Methods&lt;br /&gt;It is very useful to be able to invoke an overridden method from the method that overrides it. The keyword “super” allows to access features of a class "up" in the hierarchy. &lt;br /&gt;Example:&lt;br /&gt;      class Animal {&lt;br /&gt;            void saySomething() {&lt;br /&gt;                  System.out.println("Our kind is unable to speak");&lt;br /&gt;            }&lt;br /&gt;      } &lt;br /&gt;      class Dog extends Animal {&lt;br /&gt;            void saySomething() {&lt;br /&gt;                  super.saySomething();&lt;br /&gt;                  System.out.println("Wof!");&lt;br /&gt;            }&lt;br /&gt;      } &lt;br /&gt;      Dog d = new Dog();&lt;br /&gt;      d.saySomething(); &lt;br /&gt;      Result: &lt;br /&gt;      Our kind is unable to speak&lt;br /&gt;      Wof!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2056945240977755077-3540674090310952226?l=javacrackers.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/qn2Zd48Pw7iOstNK5BwH6hmRAGY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/qn2Zd48Pw7iOstNK5BwH6hmRAGY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/qn2Zd48Pw7iOstNK5BwH6hmRAGY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/qn2Zd48Pw7iOstNK5BwH6hmRAGY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/blogspot/nQxR?a=yfE65SEl-rY:tU94l9GGwFw:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/blogspot/nQxR?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://javacrackers.blogspot.com/feeds/3540674090310952226/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://javacrackers.blogspot.com/2007/11/overriding.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/3540674090310952226?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/3540674090310952226?v=2" /><link rel="alternate" type="text/html" href="http://javacrackers.blogspot.com/2007/11/overriding.html" title="OVERRIDING" /><author><name>gautam</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://4.bp.blogspot.com/_ACUdDpwsnW0/Sl6zJQlW8kI/AAAAAAAAAoA/d9Gu11zRf0w/s1600-R/ls_0724_twitte-gatam.JPG" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;C08BQ3g7fCp7ImA9WB9VFEQ.&quot;"><id>tag:blogger.com,1999:blog-2056945240977755077.post-277966254251275006</id><published>2007-12-01T12:19:00.000+05:30</published><updated>2007-12-01T12:20:52.604+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-12-01T12:20:52.604+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SCJP" /><category scheme="http://www.blogger.com/atom/ns#" term="tutorial" /><category scheme="http://www.blogger.com/atom/ns#" term="JAVA" /><title>OVERLOADING</title><content type="html">Overloading is about reusing the same method name with different arguments and sometimes different return type. Some basic rules apply: &lt;br /&gt;• In the class that defines de original method, or a subclass of that class, the method name can be reused if the argument list differs in terms of the type of at least one argument. &lt;br /&gt;• A difference in return type alone is insufficient to constitute an overload and is illegal. &lt;br /&gt;Example #1:&lt;br /&gt;      public static void main(String args[]) { &lt;br /&gt;            System.out.println( DoubleIt("Hello world") );&lt;br /&gt;            System.out.println( DoubleIt(15) );&lt;br /&gt;      }&lt;br /&gt;      static String DoubleIt(String name) {&lt;br /&gt;            name += " " + name;&lt;br /&gt;            return name;&lt;br /&gt;      }&lt;br /&gt;      static String DoubleIt(int id) {&lt;br /&gt;            id *= 2;&lt;br /&gt;            return Integer.toString(id);&lt;br /&gt;      } &lt;br /&gt;      Result:&lt;br /&gt;      Hello Hello&lt;br /&gt;      30&lt;br /&gt;Example #2:&lt;br /&gt;      int MyMethod(int a) { }&lt;br /&gt;      float MyMethod(int a) { } // ERROR!!!. Difference in return type alone&lt;br /&gt;        // is insufficient to constitute an overload.&lt;br /&gt;Example #3:&lt;br /&gt;      int MyMethod(int value) { }&lt;br /&gt;      float MyMethod(int number) { } // ERROR!!!. The types should be &lt;br /&gt;                // different, not the variable names.&lt;br /&gt;Invoking Overloaded Methods&lt;br /&gt;Method overloaded names are effectively independent methods. Using the same name is just a convenience to the programmer. Overloaded methods may call one another simply by providing a normal method call with an appropriately formed argument list. &lt;br /&gt;Example:&lt;br /&gt;      public static void main(String args[]) {&lt;br /&gt;            allStars(15);&lt;br /&gt;      } &lt;br /&gt;      static void allStars(String name) {&lt;br /&gt;            name = "*** " + name + " ***";&lt;br /&gt;            System.out.println(name);&lt;br /&gt;      }&lt;br /&gt;      static void allStars(int id) {&lt;br /&gt;            String s = ""+id;&lt;br /&gt;            allStars(s);&lt;br /&gt;      }&lt;br /&gt;In this example, we have created a method to show names surrounded by stars, we also wanted to accept int values, so we added a method that receives ints but converts them to strings and passes the result to the original string method.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2056945240977755077-277966254251275006?l=javacrackers.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ZY4NlJR-yx0KEmKCOIIzs_YNFfc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ZY4NlJR-yx0KEmKCOIIzs_YNFfc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/ZY4NlJR-yx0KEmKCOIIzs_YNFfc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ZY4NlJR-yx0KEmKCOIIzs_YNFfc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/blogspot/nQxR?a=OlvU-NGNOGk:27Y013ykWGc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/blogspot/nQxR?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://javacrackers.blogspot.com/feeds/277966254251275006/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://javacrackers.blogspot.com/2007/11/overloading.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/277966254251275006?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/277966254251275006?v=2" /><link rel="alternate" type="text/html" href="http://javacrackers.blogspot.com/2007/11/overloading.html" title="OVERLOADING" /><author><name>gautam</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://4.bp.blogspot.com/_ACUdDpwsnW0/Sl6zJQlW8kI/AAAAAAAAAoA/d9Gu11zRf0w/s1600-R/ls_0724_twitte-gatam.JPG" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CkcFRnw8eCp7ImA9WB9VE08.&quot;"><id>tag:blogger.com,1999:blog-2056945240977755077.post-3426320006838212585</id><published>2007-11-29T12:36:00.001+05:30</published><updated>2007-11-29T12:36:57.270+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-11-29T12:36:57.270+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SCJP" /><category scheme="http://www.blogger.com/atom/ns#" term="DUMPS" /><category scheme="http://www.blogger.com/atom/ns#" term="JAVA" /><title>JAVA DUMPS 12(SCJP)</title><content type="html">&lt;span xmlns=''&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 60&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;1. public class Foo {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;2. public void main( String[] args ) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;3. System.out.printIn( "Hello" + args[0] );&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;4. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;5. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;What is the result if this code is executed with the command line?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;java Foo world&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;A. Hello&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;B. Hello Foo&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;C. Hello world&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;D. Compilation fails.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;E. The code does not run.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: E&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 61&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;11. public void foo( boolean a, boolean b ){&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;12. if( a ) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;13. System.out.println( "A" );&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;14. } else if ( a &amp;amp;&amp;amp; b ) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;15. System.out.println( "A&amp;amp;&amp;amp;B" );&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;16. } else {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;17. if ( !b ) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;18. System.out.println( "notB" );&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;19. } else {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;20. System.out.println( "ELSE" );&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;21. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;22. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;23. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;What is correct?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;A. If a is true and b is true then the output is "A&amp;amp;&amp;amp;B".&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;B. If a is true and b is false then the output is "notB".&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;C. If a is false and b is true then the output is "ELSE".&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;D. If a is false and b is false then the output is "ELSE".&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: C&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 62&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Which two cause a compiler error? (Choose two)&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;A. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;int[] scores = {3, 5, 7};&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;B. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;int [][] scores = {2,7,6}, {9,3,45};&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;C. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;String cats[] = {"Fluffy", "Spot", "Zeus"};&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;D. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;boolean results[] = new boolean [3] {true, false, true};&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;E. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;Integer results[] = {new Integer(3), new Integer(5), new&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;Integer(8)};&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;F. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;String[] dogs = new String[]{new String("Fido"),new&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;String("Spike"), new String("Aiko")};&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: B, D&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 63&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;11. int i = 0, j = 5;12. tp; for (;;) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;12. i++;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;13. for(;;) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;14. if (i&amp;gt; --j) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;15. break tp;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;16. break tp;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;17. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;18. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;19. System.out.printIn("i=" +i ",j ="+j);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;What is the result?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;A. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;i = 1, j = 0&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;B. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;i = 1, j = 4&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;C. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;i = 3, j = 4&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-size:11pt'&gt;&lt;span style='font-family:Arial'&gt;D. &lt;/span&gt;&lt;span style='font-family:Arial'&gt;i = 3, j = 0&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;E. Compilation fails.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: E&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 64&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;1. public abstract class Test {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;2. public abstract void methodA();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;3.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;4. public abstract void methodB()&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;5. {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;6. System.out.println("Hello");&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;7. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;8. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Which two changes, independently applied, allow this code to compile? (Choose two)&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;A. Add a method body to methodA.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;B. Replace lines 5 – 7 with a semicolon (";").&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;C. Remove the abstract qualifier from the declaration of Test.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;D. Remove the abstract qualifier from the declaration of methodA.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;E. Remove the abstract qualifier from the declaration of methodB.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: B, E&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 65&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;1. public class Test {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;2. public static void main(String Args[]) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;3. int i =1, j = 0;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;4. switch(i) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;5. case 2: j +=6;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;6. case 4: j +=1;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;7. default: j +=2;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;8. case 0: j +=4;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;9. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;10. System.out.printIn("j =" +j);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;11. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;12. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;What is the result?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;A. 0&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;B. 2&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;C. 4&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;D. 6&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;E. 9&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;F. 13&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: D&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;QUESTION NO: 66&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Given:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;1. class A {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;2. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;3. class Alpha {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;4. private A myA = new A();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;5.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;6. void dolt( A a ) {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;7. a = null;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;8. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;9. void tryIt() {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;10. dolt( myA );&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;11. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;12. }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Which two statements are correct? (Choose two)&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;A. There are no instanced of A that will become eligible for garbage collection.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;B. Explicitly setting myA to null marks that instance to be eligible for garbage collection.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;C. Any call on tryIt() causes the private instance of A to be marked for garbage&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;collection.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;D. Private instances of A become eligible for garbage collection when instances of Alpha&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;become eligible for garbage collection.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:11pt'&gt;&lt;strong&gt;Answer: B, D&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2056945240977755077-3426320006838212585?l=javacrackers.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/NtIBKVKN4irHYzVXINOcNCXp-HQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/NtIBKVKN4irHYzVXINOcNCXp-HQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/NtIBKVKN4irHYzVXINOcNCXp-HQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/NtIBKVKN4irHYzVXINOcNCXp-HQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/blogspot/nQxR?a=GgGMHfunml0:Z6t2eF1y84k:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/blogspot/nQxR?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://javacrackers.blogspot.com/feeds/3426320006838212585/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://javacrackers.blogspot.com/2007/11/java-dumps-12scjp.html#comment-form" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/3426320006838212585?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2056945240977755077/posts/default/3426320006838212585?v=2" /><link rel="alternate" type="text/html" href="http://javacrackers.blogspot.com/2007/11/java-dumps-12scjp.html" title="JAVA DUMPS 12(SCJP)" /><author><name>gautam</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://4.bp.blogspot.com/_ACUdDpwsnW0/Sl6zJQlW8kI/AAAAAAAAAoA/d9Gu11zRf0w/s1600-R/ls_0724_twitte-gatam.JPG" /></author><thr:total>4</thr:total></entry></feed>

