<?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" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;DkECRHo_cCp7ImA9WhRbEU0.&quot;"><id>tag:blogger.com,1999:blog-499460786565996554</id><updated>2012-02-01T19:27:45.448+05:30</updated><category term="Source code" /><category term="Programs(Moderate)" /><category term="Notable" /><category term="General" /><category term="Programs (Easy)" /><category term="Quiz of the day" /><category term="Questions/Answers" /><category term="Eclipse" /><category term="Puzzle" /><category term="Video" /><category term="Java tutorial" /><category term="Interview" /><category term="SCJP/OCJP" /><title>Java is the future !</title><subtitle type="html" /><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://java.chankeypathak.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://java.chankeypathak.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Chankey Pathak</name><uri>http://www.blogger.com/profile/04990026893506195372</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://1.bp.blogspot.com/_QaES48F1VIg/TRBKsmJYKTI/AAAAAAAAAkg/Evavac_bHNc/S220/100_5098.JPG" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>129</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/JavaIsTheFuture" /><feedburner:info uri="javaisthefuture" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><link rel="license" type="text/html" href="http://creativecommons.org/licenses/by-nc-nd/3.0/" /><logo>http://creativecommons.org/images/public/somerights20.gif</logo><feedburner:emailServiceId>JavaIsTheFuture</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><entry gd:etag="W/&quot;A0UFRH4-fSp7ImA9WhdQFEo.&quot;"><id>tag:blogger.com,1999:blog-499460786565996554.post-5765796183054379088</id><published>2011-08-16T12:50:00.000+05:30</published><updated>2011-08-16T12:50:15.055+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-16T12:50:15.055+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Questions/Answers" /><category scheme="http://www.blogger.com/atom/ns#" term="Quiz of the day" /><title>Quiz of the day | OCPJP - Aug 16, 2011</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-AOQCrVomSwg/TkoZ7QE7RII/AAAAAAAAAu0/i8D0678Zzxs/s1600/285205_10150277445624341_201821239340_7404051_4607052_n.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="197" src="http://2.bp.blogspot.com/-AOQCrVomSwg/TkoZ7QE7RII/AAAAAAAAAu0/i8D0678Zzxs/s400/285205_10150277445624341_201821239340_7404051_4607052_n.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="border-collapse: collapse; color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 14px;"&gt;What will be the result of compiling and running the following code:&lt;br /&gt;
&lt;br /&gt;
Options :&lt;br /&gt;
a) true&lt;br /&gt;
true&lt;br /&gt;
b) false&lt;br /&gt;
true&lt;br /&gt;
c) false&lt;br /&gt;
false&lt;br /&gt;
d) None of the above&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="border-collapse: collapse; color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 14px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="border-collapse: collapse; color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 14px;"&gt;Solution:&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 14px;"&gt;Correct choice is option B.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="border-collapse: collapse; color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 14px;"&gt;Creating a new instance of the class File, you're not yet making an actual file, you're just creating a filename. So file.exists() return false.&lt;br /&gt;
createNewFile() method created an actual file. So file.exists() return true.&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/499460786565996554-5765796183054379088?l=java.chankeypathak.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Y1pMVHjWhwfsnpcB9yiXWdCIF7o/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Y1pMVHjWhwfsnpcB9yiXWdCIF7o/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/Y1pMVHjWhwfsnpcB9yiXWdCIF7o/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Y1pMVHjWhwfsnpcB9yiXWdCIF7o/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://java.chankeypathak.com/feeds/5765796183054379088/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://java.chankeypathak.com/2011/08/quiz-of-day-ocpjp-aug-16-2011.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/5765796183054379088?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/5765796183054379088?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaIsTheFuture/~3/_69FZ8UlkcA/quiz-of-day-ocpjp-aug-16-2011.html" title="Quiz of the day | OCPJP - Aug 16, 2011" /><author><name>Chankey Pathak</name><uri>http://www.blogger.com/profile/04990026893506195372</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://1.bp.blogspot.com/_QaES48F1VIg/TRBKsmJYKTI/AAAAAAAAAkg/Evavac_bHNc/S220/100_5098.JPG" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-AOQCrVomSwg/TkoZ7QE7RII/AAAAAAAAAu0/i8D0678Zzxs/s72-c/285205_10150277445624341_201821239340_7404051_4607052_n.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://java.chankeypathak.com/2011/08/quiz-of-day-ocpjp-aug-16-2011.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEUAQX4-cSp7ImA9WhdQFEo.&quot;"><id>tag:blogger.com,1999:blog-499460786565996554.post-6893575878130190579</id><published>2011-08-16T11:59:00.001+05:30</published><updated>2011-08-16T12:00:40.059+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-16T12:00:40.059+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="General" /><title>How to become a Java developer?</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span class="Apple-style-span" style="font-family: verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 20px;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 3px; padding-left: 0px; padding-right: 3px; padding-top: 5px;"&gt;"I want to be a java developer, What are the all skills that I need to have. I have learned the core java in college but what now?"&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 3px; padding-left: 0px; padding-right: 3px; padding-top: 5px;"&gt;Does this sound a familiar question! You too may have a similar question in your mind. Don't worry, This article explains what are all the skills that you will need to be a Java web developer, and what are the skills that you are expected to have when you appear for an interview for a Java/J2EE web developer.&lt;/div&gt;&lt;h2 style="font-family: Georgia, 'Times New Roman', Times, serif; font-size: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 3px; padding-left: 0px; padding-right: 5px; padding-top: 10px;"&gt;Java developer! But what kind of?&lt;/h2&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 3px; padding-left: 0px; padding-right: 3px; padding-top: 5px;"&gt;Let me clarify, this article is about the Java web development. As most of the time, when beginner say, 'I want to be a java developer', he actually means he wants to be a java web developer and wants to get involved in developing web applications. Otherwise, Java development in general is a vast field, today Java is used in many types of platforms, that includes Personal computers, Main frames, Hand held portable devices, Mobiles, Smart cards, Games and many more thing. But the biggest stream of java development that creates more jobs than any other stream is the JavaEE platform. The JavaEE platform is used to create the enterprise applications (It includes web applications as well).&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 3px; padding-left: 0px; padding-right: 3px; padding-top: 5px;"&gt;So be clear in your mind, This article is about java web development or enterprise application development. Most of the time when you read a job classified for skills, “Spring, Spring MVC, Struts, Hibernate, EJB” they are for java web development.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 3px; padding-left: 0px; padding-right: 3px; padding-top: 5px;"&gt;So, now it’s clear that you want to be a Java web developer and looking for a jump start. So here are the skills that will get you going.&lt;/div&gt;&lt;h2 style="font-family: Georgia, 'Times New Roman', Times, serif; font-size: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 3px; padding-left: 0px; padding-right: 5px; padding-top: 10px;"&gt;Step 1 : First thing first, know the basics, learn core Java&lt;/h2&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 3px; padding-left: 0px; padding-right: 3px; padding-top: 5px;"&gt;The first thing you must learn is Core Java. Having a solid foundation in core java will help you when you jump into the advanced java. No matter what Java technologies you plan to work on, you will need to use the core java every day. So it is absolutely must to have a good understanding of the core concepts. Learn the basic programming concepts like variables, branching and looping, logical conditions, data types etc.&lt;/div&gt;&lt;h3 style="font-family: Georgia, 'Times New Roman', Times, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 3px; padding-left: 0px; padding-right: 5px; padding-top: 10px;"&gt;Good understanding of core java library is a must&lt;/h3&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 3px; padding-left: 0px; padding-right: 3px; padding-top: 5px;"&gt;Learn core java library, especially collection framework, Threads, java.lang, java.io packages. If you are targeting the web development, you may not want to waste time on the swing.&lt;br /&gt;
Get yourself a good core java book that covers the latest java edition JDK 1.6. (When I was a beginner, I read “The complete reference java”)&lt;/div&gt;&lt;h2 style="font-family: Georgia, 'Times New Roman', Times, serif; font-size: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 3px; padding-left: 0px; padding-right: 5px; padding-top: 10px;"&gt;Step 2 : Learn to use an IDE (Integrated Development Environment)&lt;/h2&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 3px; padding-left: 0px; padding-right: 3px; padding-top: 5px;"&gt;While working as a professional, you won’t use the plain text editors to write the code, you will have to know how to use IDE. IDE A.K.A code editor will greatly improve your productivity, and make your life easier. Code editors are used to write, compile, run and debug code. They provide features like syntax highlighting, auto completion, can identify the problems in code even before compiling. These are some of the most common features, but there are many more than just these. I will recommend you to learn&amp;nbsp;&lt;a href="http://www.eclipse.org/" rel="nofollow" style="color: #666666; outline-color: initial; outline-style: none; outline-width: initial; text-decoration: none;" target="_blank"&gt;eclipse&lt;/a&gt;&amp;nbsp;which is one of the most popular IDE amongst java developer, and its free.&lt;/div&gt;&lt;h2 style="font-family: Georgia, 'Times New Roman', Times, serif; font-size: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 3px; padding-left: 0px; padding-right: 5px; padding-top: 10px;"&gt;Step 3 : Your first step towards web development, HTML, CSS and JavaScript&lt;/h2&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 3px; padding-left: 0px; padding-right: 3px; padding-top: 5px;"&gt;I will not explain what HTML or CSS is, there are plenty of resources available on the internet. But understand, this is the most important parts of any web application. Second most important thing to learn is JavaScript, let me clarify, the JavaScript is not java, the similarity in name is for historical reasons. Get yourself into the world of web applications with this three skills, learn some tutorials on the internet or get some good book.&lt;/div&gt;&lt;h2 style="font-family: Georgia, 'Times New Roman', Times, serif; font-size: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 3px; padding-left: 0px; padding-right: 5px; padding-top: 10px;"&gt;Step 4 : The java web components, Servlet API and JSP&lt;/h2&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 3px; padding-left: 0px; padding-right: 3px; padding-top: 5px;"&gt;Almost every web application running on internet or intranet which is developed in Java has their roots in Servlet API. So next thing to learn is servlets. Servlet API is the only standard API for java web application development. JSP is also based on the servlet API. Almost all the web frameworks, like Spring MVC, Struts, Wicket uses the servlet API under the hood. Get yourself a good book like “head first servlet”. Having the solid understanding of the Servlet API is quite important. Understand the core concepts like, life cycle, request, response, filters, session, config, context etc.&lt;/div&gt;&lt;h2 style="font-family: Georgia, 'Times New Roman', Times, serif; font-size: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 3px; padding-left: 0px; padding-right: 5px; padding-top: 10px;"&gt;Step 5 : Learn a web container&lt;/h2&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 3px; padding-left: 0px; padding-right: 3px; padding-top: 5px;"&gt;Web container is a run time environment or server that is used to deploy and run the web applications or more specifically Web components (Eg servlets or JSP)&lt;br /&gt;
Web containers does not know how to run struts or Spring MVC, they just understand the servlet API, but still you can run them on a web container, because ultimately they are based on the Servlet API. You can learn the tomcat, that would be sufficient initially.&lt;/div&gt;&lt;h2 style="font-family: Georgia, 'Times New Roman', Times, serif; font-size: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 3px; padding-left: 0px; padding-right: 5px; padding-top: 10px;"&gt;Step 6 : Learn JDBC&lt;/h2&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 3px; padding-left: 0px; padding-right: 3px; padding-top: 5px;"&gt;Almost every web application will need to connect to a database for storing and retrieving persistent data. JDBC is the standard API for database connectivity. So it is quite important that you understand the JDBC well.&lt;/div&gt;&lt;h2 style="font-family: Georgia, 'Times New Roman', Times, serif; font-size: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 3px; padding-left: 0px; padding-right: 5px; padding-top: 10px;"&gt;Step 7 : Learn a web application framework and an ORM framework&lt;/h2&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 3px; padding-left: 0px; padding-right: 3px; padding-top: 5px;"&gt;A web application framework is actually a set of libraries that makes developing web applications easier. Struts and Spring MVC are good choices. If you are just starting, I would recommend going with Spring MVC.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 3px; padding-left: 0px; padding-right: 3px; padding-top: 5px;"&gt;ORM stands for object to relational mapping, they are based on JDBC and used for storing and querying the database. But unlike JDBC, ORM frameworks operates on objects and provides ways for storing and retrieving objects. (But be clear, they are ultimately using JDBC under the hood). ORM frameworks reduces lots of boilerplate code, improves productivity and makes developers life easier. Hibernate is the best choice. If you are just starting, read and understand JPA (Java persistence API) which is the standard java ORM API. You can use hibernate for running your JPA code.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 3px; padding-left: 0px; padding-right: 3px; padding-top: 5px;"&gt;That's it. If you know everything I mentioned above well, you are all set to get a job as java web developer.&lt;/div&gt;&lt;h2 style="font-family: Georgia, 'Times New Roman', Times, serif; font-size: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 3px; padding-left: 0px; padding-right: 5px; padding-top: 10px;"&gt;Step 8 : What next!&lt;/h2&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 3px; padding-left: 0px; padding-right: 3px; padding-top: 5px;"&gt;Once you are familiar with the things mentioned above, The next step would be to learn the JavaEE (Java enterprise edition). Learn EJB (Enterprise java beans), JSF (Java server faces) and other APIs that are part of the JavaEE. Get a good book that covers the latest JavaEE edition 1.6&lt;/div&gt;&lt;h2 style="font-family: Georgia, 'Times New Roman', Times, serif; font-size: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 3px; padding-left: 0px; padding-right: 5px; padding-top: 10px;"&gt;Resources&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html" rel="nofollow" style="color: #666666; outline-color: initial; outline-style: none; outline-width: initial; text-decoration: none;"&gt;Official JDK download&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.servletworld.com/servlet-tutorials/setup-servlet-development-environment.html" style="color: #666666; outline-color: initial; outline-style: none; outline-width: initial; text-decoration: none;"&gt;Installing JDK&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jcp.org/en/jsr/detail?id=315" rel="nofollow" style="color: #666666; outline-color: initial; outline-style: none; outline-width: initial; text-decoration: none;"&gt;Servlet 3.0 Specification&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://tomcat.apache.org/" rel="nofollow" style="color: #666666; outline-color: initial; outline-style: none; outline-width: initial; text-decoration: none;"&gt;Apache Tomcat official site&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.eclipse.org/" style="color: #666666; outline-color: initial; outline-style: none; outline-width: initial; text-decoration: none;"&gt;Eclipse IDE official site&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.springsource.org/documentation" rel="nofollow" style="color: #666666; outline-color: initial; outline-style: none; outline-width: initial; text-decoration: none;"&gt;Spring framework documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.coderanch.com/forums" rel="nofollow" style="color: #666666; outline-color: initial; outline-style: none; outline-width: initial; text-decoration: none;"&gt;JavaRanch forums&lt;/a&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.servletworld.com/servlet-tutorials/i-want-to-be-java-developer.html" rel="nofollow" style="color: #666666; outline-color: initial; outline-style: none; outline-width: initial; text-decoration: none;"&gt;Servletworld&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/499460786565996554-6893575878130190579?l=java.chankeypathak.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/cj1QwVhkO3DbFUBdSmxFQEdcypg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/cj1QwVhkO3DbFUBdSmxFQEdcypg/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/cj1QwVhkO3DbFUBdSmxFQEdcypg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/cj1QwVhkO3DbFUBdSmxFQEdcypg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://java.chankeypathak.com/feeds/6893575878130190579/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://java.chankeypathak.com/2011/08/how-to-become-java-developer.html#comment-form" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/6893575878130190579?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/6893575878130190579?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaIsTheFuture/~3/qGUxfcSall8/how-to-become-java-developer.html" title="How to become a Java developer?" /><author><name>Chankey Pathak</name><uri>http://www.blogger.com/profile/04990026893506195372</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://1.bp.blogspot.com/_QaES48F1VIg/TRBKsmJYKTI/AAAAAAAAAkg/Evavac_bHNc/S220/100_5098.JPG" /></author><thr:total>4</thr:total><feedburner:origLink>http://java.chankeypathak.com/2011/08/how-to-become-java-developer.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkMFRHY7fip7ImA9WhdQFEo.&quot;"><id>tag:blogger.com,1999:blog-499460786565996554.post-2202561185528191900</id><published>2011-08-16T10:23:00.000+05:30</published><updated>2011-08-16T10:23:35.806+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-16T10:23:35.806+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Questions/Answers" /><category scheme="http://www.blogger.com/atom/ns#" term="Puzzle" /><category scheme="http://www.blogger.com/atom/ns#" term="Quiz of the day" /><title>Quiz of the day | OCPJP - 16 Aug 2011</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-nqOszYWBbso/Tkn3mJzDtyI/AAAAAAAAAuw/DjzEQwYkn3I/s1600/294040_10150290748099341_201821239340_7528294_665489_n.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="400" src="http://2.bp.blogspot.com/-nqOszYWBbso/Tkn3mJzDtyI/AAAAAAAAAuw/DjzEQwYkn3I/s400/294040_10150290748099341_201821239340_7528294_665489_n.jpg" width="391" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;&lt;br /&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 14px;"&gt;What is the output for the above code ?&lt;br /&gt;
&lt;br /&gt;
Options :&lt;br /&gt;
a) Compile with error - Not allowed to override the return type of a method with a subtype of the original type.&lt;br /&gt;
b) class A - return C&lt;br /&gt;
c) class B - return D&lt;br /&gt;
d) Runtime Exception&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/499460786565996554-2202561185528191900?l=java.chankeypathak.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ZZq9UYH6-Yey0gXSzbu7EQBVkZs/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ZZq9UYH6-Yey0gXSzbu7EQBVkZs/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/ZZq9UYH6-Yey0gXSzbu7EQBVkZs/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ZZq9UYH6-Yey0gXSzbu7EQBVkZs/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://java.chankeypathak.com/feeds/2202561185528191900/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://java.chankeypathak.com/2011/08/quiz-of-day-ocpjp-16-aug-2011.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/2202561185528191900?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/2202561185528191900?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaIsTheFuture/~3/6MOcrPquRwA/quiz-of-day-ocpjp-16-aug-2011.html" title="Quiz of the day | OCPJP - 16 Aug 2011" /><author><name>Chankey Pathak</name><uri>http://www.blogger.com/profile/04990026893506195372</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://1.bp.blogspot.com/_QaES48F1VIg/TRBKsmJYKTI/AAAAAAAAAkg/Evavac_bHNc/S220/100_5098.JPG" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-nqOszYWBbso/Tkn3mJzDtyI/AAAAAAAAAuw/DjzEQwYkn3I/s72-c/294040_10150290748099341_201821239340_7528294_665489_n.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://java.chankeypathak.com/2011/08/quiz-of-day-ocpjp-16-aug-2011.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ak8ERXg8fCp7ImA9WhZWE0k.&quot;"><id>tag:blogger.com,1999:blog-499460786565996554.post-5708602886287525603</id><published>2011-05-14T10:23:00.000+05:30</published><updated>2011-05-14T10:23:24.674+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-14T10:23:24.674+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Questions/Answers" /><category scheme="http://www.blogger.com/atom/ns#" term="SCJP/OCJP" /><title>char a = '\u000A'. Why is this invalid?</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; font-family: Arial, Helvetica, sans-serif; font-size: 16px;"&gt;&lt;/span&gt;&lt;br /&gt;
Unicode escape characters of the form '\Uxxxx', where xxxx is a hexadecimal value, are processed very early in the translation process (see&amp;nbsp;&lt;a href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.4" rel="nofollow" style="color: navy;"&gt;JLS 3.10.4&lt;/a&gt;&amp;nbsp;). As a result, the special characters '0A' (line feed) and '0D' (carriage return) are interpreted literally as "end of line."&lt;br /&gt;
For example, the expression..&lt;a href="http://www.coderanch.com/how-to/java/SCJP-FAQ#invalidUnicode"&gt;.&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;char A = '\u000A';&lt;/pre&gt;...therefore becomes...&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;char A =;&lt;/pre&gt;...which results in a compile-time error.&lt;br /&gt;
To avoid this error, always use the special escape characters '\n' (line feed) and '\r' (carriage return).&lt;br /&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/499460786565996554-5708602886287525603?l=java.chankeypathak.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/9NFQJ4DrOmRupMb_N9yZbYyBdOE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9NFQJ4DrOmRupMb_N9yZbYyBdOE/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/9NFQJ4DrOmRupMb_N9yZbYyBdOE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9NFQJ4DrOmRupMb_N9yZbYyBdOE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://java.chankeypathak.com/feeds/5708602886287525603/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://java.chankeypathak.com/2011/05/char-u000a-why-is-this-invalid.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/5708602886287525603?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/5708602886287525603?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaIsTheFuture/~3/upaNTsR8wec/char-u000a-why-is-this-invalid.html" title="char a = '\u000A'. Why is this invalid?" /><author><name>Chankey Pathak</name><uri>http://www.blogger.com/profile/04990026893506195372</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://1.bp.blogspot.com/_QaES48F1VIg/TRBKsmJYKTI/AAAAAAAAAkg/Evavac_bHNc/S220/100_5098.JPG" /></author><thr:total>0</thr:total><feedburner:origLink>http://java.chankeypathak.com/2011/05/char-u000a-why-is-this-invalid.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0MNSXozeCp7ImA9WhZWE04.&quot;"><id>tag:blogger.com,1999:blog-499460786565996554.post-592669415054910975</id><published>2011-05-14T06:41:00.000+05:30</published><updated>2011-05-14T06:41:38.480+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-14T06:41:38.480+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Questions/Answers" /><category scheme="http://www.blogger.com/atom/ns#" term="SCJP/OCJP" /><title>Is it allowed to declare the main method private?</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; font-family: Arial, Helvetica, sans-serif; font-size: 16px;"&gt;&lt;/span&gt;&lt;br /&gt;
Former JVM versions (pre-1.4) allowed the main method to have any accessibility (private, etc). This incompatibility with Section 12.1.4 of the Java Language Specification has been fixed as of version 1.4. In order to invoke a main method from the command-line, it is now mandatory to declare the main method as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;public static void main (String[] args)&lt;/pre&gt;If the main method has any access level other than public, it will no longer run from the command-line&lt;a href="http://www.coderanch.com/how-to/java/SCJP-FAQ#mainPrivate"&gt;.&lt;/a&gt;&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/499460786565996554-592669415054910975?l=java.chankeypathak.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/pP-qPdhYyXFUaE8sbKvEOEGZ4vs/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/pP-qPdhYyXFUaE8sbKvEOEGZ4vs/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/pP-qPdhYyXFUaE8sbKvEOEGZ4vs/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/pP-qPdhYyXFUaE8sbKvEOEGZ4vs/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://java.chankeypathak.com/feeds/592669415054910975/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://java.chankeypathak.com/2011/05/is-it-allowed-to-declare-main-method.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/592669415054910975?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/592669415054910975?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaIsTheFuture/~3/4I5wUXsNN3I/is-it-allowed-to-declare-main-method.html" title="Is it allowed to declare the main method private?" /><author><name>Chankey Pathak</name><uri>http://www.blogger.com/profile/04990026893506195372</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://1.bp.blogspot.com/_QaES48F1VIg/TRBKsmJYKTI/AAAAAAAAAkg/Evavac_bHNc/S220/100_5098.JPG" /></author><thr:total>0</thr:total><feedburner:origLink>http://java.chankeypathak.com/2011/05/is-it-allowed-to-declare-main-method.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUQDQ389fip7ImA9WhZQFk4.&quot;"><id>tag:blogger.com,1999:blog-499460786565996554.post-6788548189055000406</id><published>2011-04-24T13:47:00.001+05:30</published><updated>2011-04-24T13:52:52.166+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-04-24T13:52:52.166+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Questions/Answers" /><category scheme="http://www.blogger.com/atom/ns#" term="SCJP/OCJP" /><title>What are some potential trips/traps in the SCJP exam?</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; font-family: Arial, Helvetica, sans-serif; font-size: 16px;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Two top-level public classes cannot be in the same source file.&lt;/li&gt;
&lt;li&gt;main()&amp;nbsp;cannot call an instance (non-static) method.&lt;/li&gt;
&lt;li&gt;Methods can have the same name as the constructor(s).&lt;/li&gt;
&lt;li&gt;Watch for thread initiation with classes that don't have a run() method.&lt;/li&gt;
&lt;li&gt;Local classes cannot access non-final variables.&lt;/li&gt;
&lt;li&gt;Case statements must have values within permissible range.&lt;/li&gt;
&lt;li&gt;Watch for Math class being an option for immutable classes.&lt;/li&gt;
&lt;li&gt;instanceOf is not the same as instanceof.&lt;/li&gt;
&lt;li&gt;Constructors can be private.&lt;/li&gt;
&lt;li&gt;Assignment statements can be mistaken for a comparison; e.g., if(a=true)...&lt;/li&gt;
&lt;li&gt;Watch for System.exit() in try-catch-finally blocks.&lt;/li&gt;
&lt;li&gt;Watch for uninitialized variable references with no path of proper initialization.&lt;/li&gt;
&lt;li&gt;Order of try-catch-finally blocks matters.&lt;/li&gt;
&lt;li&gt;main() can be declared final.&lt;/li&gt;
&lt;li&gt;-0.0 == 0.0 is true.&lt;/li&gt;
&lt;li&gt;A class without abstract methods can still be declared abstract.&lt;/li&gt;
&lt;li&gt;Map does not implement Collection.&lt;/li&gt;
&lt;li&gt;Dictionary is a class, not an interface.&lt;/li&gt;
&lt;li&gt;Collection (singular) is an Interface, but Collections (plural) is a helper class.&lt;/li&gt;
&lt;li&gt;Class declarations can come in any order (e.g., derived first, base next, etc.).&lt;/li&gt;
&lt;li&gt;Forward references to variables gives a compiler error.&lt;/li&gt;
&lt;li&gt;Multi-dimensional arrays can be "sparse" -- i.e., if you imagine the array as a matrix, every row need not have the same number of columns.&lt;/li&gt;
&lt;li&gt;Arrays, whether local or class-level, are always initialized&lt;/li&gt;
&lt;li&gt;Strings are initialized to null, not empty string.&lt;/li&gt;
&lt;li&gt;An empty string is not the same as a null reference.&lt;/li&gt;
&lt;li&gt;A declaration cannot be labelled.&lt;/li&gt;
&lt;li&gt;continue must be in a loop (e.g., for, do, while). It cannot appear in case constructs.&lt;/li&gt;
&lt;li&gt;Primitive array types can never be assigned to each other, even though the primitives themselves can be assigned. For example, A&lt;b&gt;&lt;/b&gt;rrayofLongPrimitives = A&lt;b&gt;&lt;/b&gt;rrayofIntegerPrimitives gives compiler error even though longvar = intvar is perfectly valid.&lt;/li&gt;
&lt;li&gt;A constructor can throw any exception.&lt;/li&gt;
&lt;li&gt;Initializer blocks are executed in the order of declaration.&lt;/li&gt;
&lt;li&gt;Instance initializers are executed only if an object is constructed.&lt;/li&gt;
&lt;li&gt;All comparisons involving N&lt;b&gt;&lt;/b&gt;aN and a non-N&lt;b&gt;&lt;/b&gt;aN always result in false.&lt;/li&gt;
&lt;li&gt;Default type of a numeric literal with a decimal point is double.&lt;/li&gt;
&lt;li&gt;int and long operations / and % can throw an A&lt;b&gt;&lt;/b&gt;rithmeticException, while float and double / and % never will (even in case of division by zero).&lt;/li&gt;
&lt;li&gt;== gives compiler error if the operands are cast-incompatible.&lt;/li&gt;
&lt;li&gt;You can never cast objects of sibling classes (sharing the same parent).&lt;/li&gt;
&lt;li&gt;equals() returns false if the object types are different. It does not raise a compiler error.&lt;/li&gt;
&lt;li&gt;No inner class (non-static inner class) can have a static member.&lt;/li&gt;
&lt;li&gt;File class has no methods to deal with the contents of the file.&lt;/li&gt;
&lt;li&gt;I&lt;b&gt;&lt;/b&gt;nputStream and O&lt;b&gt;&lt;/b&gt;utputStream are abstract classes&lt;a href="http://www.coderanch.com/how-to/java/SCJP-FAQ#tripsTraps"&gt;.&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/499460786565996554-6788548189055000406?l=java.chankeypathak.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/fLm0Ud6hQDYJuhTRSqwThfe3n1A/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/fLm0Ud6hQDYJuhTRSqwThfe3n1A/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/fLm0Ud6hQDYJuhTRSqwThfe3n1A/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/fLm0Ud6hQDYJuhTRSqwThfe3n1A/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://java.chankeypathak.com/feeds/6788548189055000406/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://java.chankeypathak.com/2011/04/what-are-some-potential-tripstraps-in.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/6788548189055000406?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/6788548189055000406?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaIsTheFuture/~3/5Zc3tRCFek8/what-are-some-potential-tripstraps-in.html" title="What are some potential trips/traps in the SCJP exam?" /><author><name>Chankey Pathak</name><uri>http://www.blogger.com/profile/04990026893506195372</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://1.bp.blogspot.com/_QaES48F1VIg/TRBKsmJYKTI/AAAAAAAAAkg/Evavac_bHNc/S220/100_5098.JPG" /></author><thr:total>0</thr:total><feedburner:origLink>http://java.chankeypathak.com/2011/04/what-are-some-potential-tripstraps-in.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C04NR30_fyp7ImA9WhZQFk4.&quot;"><id>tag:blogger.com,1999:blog-499460786565996554.post-6403598511729350095</id><published>2011-04-24T13:27:00.002+05:30</published><updated>2011-04-24T13:29:56.347+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-04-24T13:29:56.347+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Questions/Answers" /><title>What's up with integers not being equal to one another? The following code prints "true, true, false, true". Shouldn't it be "true, true, true, true"?</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;script src="http://pastie.org/1827656.js"&gt;
&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
The key to understanding this is that the JVM uses a process called "boxing" (or "auto-boxing") when converting an int (like 127) to an Integer object. This involves calling the Integer.valueOf(127) method. The &lt;a href="http://download.java.net/jdk7/docs/api/java/lang/Integer.html#valueOf(int)"&gt;JavaDoc:java.lang.Integer#valueOf(int)&lt;/a&gt; says: "Returns a Integer instance representing the specified int value. If a new Integer instance is not required, this method should generally be used in preference to the constructor Integer(int), as this method is likely to yield significantly better space and time performance by caching frequently requested values." What that means is that the valueOf() method has a cache of Integer objects, and if the primitive being boxed is in that range, the cached object is returned. It just so happens that 127 is in that range, but 128 is not. So i and j are the same object, while i1 and j1 are not. &lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: xx-small;"&gt;Source: &lt;a href="http://www.coderanch.com/how-to/java/Java-FAQ#integerAutoBoxing"&gt;CodeRanch&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/499460786565996554-6403598511729350095?l=java.chankeypathak.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/FfMMyIrGB01KNEXGNnrZhJBuoeY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/FfMMyIrGB01KNEXGNnrZhJBuoeY/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/FfMMyIrGB01KNEXGNnrZhJBuoeY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/FfMMyIrGB01KNEXGNnrZhJBuoeY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://java.chankeypathak.com/feeds/6403598511729350095/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://java.chankeypathak.com/2011/04/whats-up-with-integers-not-being-equal.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/6403598511729350095?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/6403598511729350095?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaIsTheFuture/~3/loyWngm7kZ0/whats-up-with-integers-not-being-equal.html" title="What's up with integers not being equal to one another? The following code prints &quot;true, true, false, true&quot;. Shouldn't it be &quot;true, true, true, true&quot;?" /><author><name>Chankey Pathak</name><uri>http://www.blogger.com/profile/04990026893506195372</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://1.bp.blogspot.com/_QaES48F1VIg/TRBKsmJYKTI/AAAAAAAAAkg/Evavac_bHNc/S220/100_5098.JPG" /></author><thr:total>0</thr:total><feedburner:origLink>http://java.chankeypathak.com/2011/04/whats-up-with-integers-not-being-equal.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEcARXc5cSp7ImA9WhZQFk8.&quot;"><id>tag:blogger.com,1999:blog-499460786565996554.post-3118102950964209649</id><published>2011-04-24T11:48:00.002+05:30</published><updated>2011-04-24T11:50:44.929+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-04-24T11:50:44.929+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Questions/Answers" /><category scheme="http://www.blogger.com/atom/ns#" term="General" /><category scheme="http://www.blogger.com/atom/ns#" term="Programs(Moderate)" /><title>How to convert a String array to ArrayList?</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;1. &lt;script src="http://pastie.org/1827501.js"&gt;
&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. &lt;script src="http://pastie.org/1827506.js"&gt;
&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. &lt;script src="http://pastie.org/1827508.js"&gt;
&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Note&lt;/b&gt;: In the solution no 1 Arrays.asList() is efficient because it doesn't need to copy the content of the array. This method returns a List that is a "view" onto the array - a wrapper that makes the array look like a list. When you change an element in the list, the element in the original array is also changed. Note that the list is fixed size - if you try to add elements to the list, you'll get an exception. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you only need read access to the array as if it is a List and you don't want to add or remove elements from the list, then only use solution no 1.&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: xx-small;"&gt;Source: &lt;a href="http://www.coderanch.com/t/379449/java/java/String-array-arraylist"&gt;JavaRanch&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/499460786565996554-3118102950964209649?l=java.chankeypathak.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/f7k9RY1yRXyWTx3q4dck5TjPnIU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/f7k9RY1yRXyWTx3q4dck5TjPnIU/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/f7k9RY1yRXyWTx3q4dck5TjPnIU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/f7k9RY1yRXyWTx3q4dck5TjPnIU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://java.chankeypathak.com/feeds/3118102950964209649/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://java.chankeypathak.com/2011/04/how-to-convert-string-array-to.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/3118102950964209649?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/3118102950964209649?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaIsTheFuture/~3/HIDNmlIBgsg/how-to-convert-string-array-to.html" title="How to convert a String array to ArrayList?" /><author><name>Chankey Pathak</name><uri>http://www.blogger.com/profile/04990026893506195372</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://1.bp.blogspot.com/_QaES48F1VIg/TRBKsmJYKTI/AAAAAAAAAkg/Evavac_bHNc/S220/100_5098.JPG" /></author><thr:total>0</thr:total><feedburner:origLink>http://java.chankeypathak.com/2011/04/how-to-convert-string-array-to.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkYHRH8yeSp7ImA9WhZQFUU.&quot;"><id>tag:blogger.com,1999:blog-499460786565996554.post-3552084341141124712</id><published>2011-04-24T01:18:00.003+05:30</published><updated>2011-04-24T01:18:55.191+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-04-24T01:18:55.191+05:30</app:edited><title>Difference between Class reference and Interface reference</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;"&gt;Interface provides the base for the concrete classes. It defines the contract which must be full filled by the implementing classes. So it can be use full in case where you need polymorphism. for example if you have some classes and interface like:&lt;/span&gt;&lt;br /&gt;
&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;br /&gt;
&lt;script src="http://pastie.org/1826304.js"&gt;
&lt;/p&gt;&lt;p&gt;


&lt;/script&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Here if you want to do some generic work which is common for both the doctors (doCheckUp) you should use the interface like&lt;br /&gt;
&lt;br /&gt;
&lt;script src="http://pastie.org/1826307.js"&gt;
&lt;/p&gt;&lt;p&gt;


&lt;/script&gt;&lt;br /&gt;
In this case no matter which object you are passing it will call the doCheckUp method of corresponding object. But your concrete class can have some extra methods and if you want to use those methods then you have to call the methods using corresponding concrete class objects.&lt;br /&gt;
&lt;br /&gt;
So If you want to use the generic common methods, you should use the interface instance.&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/499460786565996554-3552084341141124712?l=java.chankeypathak.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/mjwwoyxEHbk7innNve6-3Eq2VUQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/mjwwoyxEHbk7innNve6-3Eq2VUQ/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/mjwwoyxEHbk7innNve6-3Eq2VUQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/mjwwoyxEHbk7innNve6-3Eq2VUQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://java.chankeypathak.com/feeds/3552084341141124712/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://java.chankeypathak.com/2011/04/difference-between-class-reference-and.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/3552084341141124712?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/3552084341141124712?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaIsTheFuture/~3/Zctp8JvEVzI/difference-between-class-reference-and.html" title="Difference between Class reference and Interface reference" /><author><name>Chankey Pathak</name><uri>http://www.blogger.com/profile/04990026893506195372</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://1.bp.blogspot.com/_QaES48F1VIg/TRBKsmJYKTI/AAAAAAAAAkg/Evavac_bHNc/S220/100_5098.JPG" /></author><thr:total>0</thr:total><feedburner:origLink>http://java.chankeypathak.com/2011/04/difference-between-class-reference-and.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkUHR30zfip7ImA9Wx9VE0Q.&quot;"><id>tag:blogger.com,1999:blog-499460786565996554.post-6979959436679978607</id><published>2011-01-30T18:58:00.002+05:30</published><updated>2011-01-30T19:00:36.386+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-01-30T19:00:36.386+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="General" /><title>Top 10 errors java programmers make</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 5px; -webkit-border-vertical-spacing: 5px;"&gt;&lt;/span&gt;&lt;br /&gt;
Whether you program regularly in Java, and know it like the back of your hand, or whether you're new to the language or a casual programmer, you'll make mistakes. It's natural, it's human, and guess what? You'll more than likely make the same mistakes that others do, over and over again. Here's my top ten list of errors that we all seem to make at one time or another,&amp;nbsp; how to spot them, and how to fix them.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;10. Accessing non-static member variables from static methods (such as main)&lt;/h3&gt;Many programmers, particularly when first introduced to Java, have problems with accessing member variables from their&amp;nbsp;&lt;em&gt;main&lt;/em&gt;&amp;nbsp;method. The method signature for main is marked static - meaning that we don't need to create an instance of the class to invoke the main method. For example, a Java Virtual Machine (JVM) could call the class MyApplication like this :-&lt;br /&gt;
&lt;blockquote&gt;MyApplication.main ( command_line_args );&lt;/blockquote&gt;This means, however, that there isn't an instance of MyApplication - it doesn't have any member variables to access! Take for example the following application, which will generate a compiler error message.&lt;br /&gt;
&lt;pre&gt;public class StaticDemo
{
        public String my_member_variable = "somedata";&lt;/pre&gt;&lt;pre&gt;public static void main (String args[])
        {
  // Access a non-static member from static method
                System.out.println ("This generates a compiler error" +
   my_member_variable );
        }
}&lt;/pre&gt;If you want to access its member variables from a non-static method (like&amp;nbsp;&lt;em&gt;main&lt;/em&gt;), you must create an instance of the object. Here's a simple example of how to correctly write code to access non-static member variables, by first creating an instance of the object.&lt;br /&gt;
&lt;pre&gt;public class NonStaticDemo
{
        public String my_member_variable = "somedata";

        public static void main (String args[])
        {
                NonStaticDemo demo = new NonStaticDemo();

  // Access member variable of demo
                System.out.println ("This WON'T generate an error" +
                        demo.my_member_variable );
        }
}&lt;/pre&gt;&lt;h3&gt;9. Mistyping the name of a method when overriding&lt;/h3&gt;Overriding allows programmers to replace a method's implementation with new code. Overriding is a handy feature, and most OO programmers make heavy use of it. If you use the AWT 1.1 event handling model, you'll often override listener implementations to provide custom functionality. One easy trap to fall into with overriding, is to mistype the method name. If you mistype the name, you're no longer overriding a method - you're creating an entirely new method, but with the same parameter and return type.&lt;br /&gt;
&lt;pre&gt;public class MyWindowListener extends WindowAdapter {
 // This should be WindowClose&lt;strong&gt;d&lt;/strong&gt;
 public void WindowClose(WindowEvent e) {
  // Exit when user closes window
  System.exit(0);
 }
});
&lt;/pre&gt;Compilers won't pick up on this one, and the problem can be quite frustrating to detect. In the past, I've looked at a method, believed that it was being called, and taken ages to spot the problem. The symptom of this error will be that your code isn't being called, or you think the method has skipped over its code. The only way to ever be certain is to add a println statement, to record a message in a log file, or to use good trace debugger (like Visual J++ or Borland JBuilder) and step through line by line. If your method still isn't being called, then it's likely you've mistyped the name.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;8. Comparison assignment (&amp;nbsp; = rather than == )&lt;/h3&gt;This is an easy error to make. If you're used other languages before, such as Pascal, you'll realize just how poor a choice this was by the language's designers. In Pascal, for example, we use the := operator for assignment, and leave = for comparison. This looks like a throwback to C/C++, from which Java draws its roots.&lt;br /&gt;
Fortunately, even if you don't spot this one by looking at code on the screen, your compiler will. Most commonly, it will report an error message like this : "Can't convert xxx to boolean", where xxx is a Java type that you're assigning instead of comparing.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;7. Comparing two objects ( == instead of .equals)&lt;/h3&gt;When we use the == operator, we are actually comparing two object references, to see if they point to the same object. We cannot compare, for example, two strings for equality, using the == operator. We must instead use the .equals method, which is a method inherited by all classes from java.lang.Object.&lt;br /&gt;
Here's the correct way to compare two strings.&lt;br /&gt;
&lt;pre&gt;String abc = "abc"; String def = "def";

// Bad way
if ( (abc + def) == "abcdef" )
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; ......
}&lt;/pre&gt;&lt;pre&gt;// Good way
if ( (abc + def).equals("abcdef") )
{
&amp;nbsp;&amp;nbsp; .....
}&lt;/pre&gt;&lt;h3&gt;6. Confusion over passing by value, and passing by reference&lt;/h3&gt;This can be a frustrating problem to diagnose, because when you look at the code, you might be sure that its passing by reference, but find that its actually being passed by value. Java uses&lt;strong&gt;both&lt;/strong&gt;, so you need to understand when you're passing by value, and when you're passing by reference.&lt;br /&gt;
When you pass a primitive data type, such as a char, int, float, or double, to a function then you are&amp;nbsp;&lt;strong&gt;passing by value&lt;/strong&gt;. That means that a copy of the data type is duplicated, and passed to the function. If the function chooses to modify that value, it will be modifying the copy only. Once the function finishes, and control is returned to the returning function, the "real" variable will be untouched, and no changes will have been saved. If you need to modify a primitive data type, make it a return value for a function, or wrap it inside an object.&lt;br /&gt;
When you pass a Java object, such as an array, a vector, or a string, to a function then you are&lt;strong&gt;passing by reference&lt;/strong&gt;. Yes - a String is actually an object, not a primitive data type.&amp;nbsp; So that means that if you pass an object to a function, you are passing a reference to it, not a duplicate. Any changes you make to the object's member variables will be permanent - which can be either good or bad, depending on whether this was what you intended.&lt;br /&gt;
On a side note, since String contains no methods to modify its contents, you might as well be passing by value.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;5. Writing blank exception handlers&lt;/h3&gt;I know it's very tempting to write blank exception handlers, and to just ignore errors. But if you run into problems, and haven't written any error messages, it becomes almost impossible to find out the cause of the error. Even the simplest exception handler can be of benefit. For example, put a try { .. } catch Exception around your code, to catch ANY type of exception, and print out the message. You don't need to write a custom handler for every exception (though this is still good programming practice). Don't ever leave it blank, or you won't know what's happening.&lt;br /&gt;
For example&lt;br /&gt;
&lt;pre&gt;public static void main(String args[])
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; try {
 // Your code goes here..
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (Exception e)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
 System.out.println ("Err - " + e );
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}&lt;/pre&gt;&lt;h3&gt;4. Forgetting that Java is zero-indexed&lt;/h3&gt;If you've come from a C/C++ background, you may not find this quite as much a problem as those who have used other languages. In Java, arrays are zero-indexed, meaning that the first element's index is actually 0. Confused? Let's look at a quick example.&lt;br /&gt;
&lt;pre&gt;// Create an array of three strings
String[] strArray = new String[3];

// First element's index is actually 0
strArray[0] = "First string";

// Second element's index is actually 1
strArray[1] = "Second string";

// Final element's index is actually 2
strArray[2] = "Third and final string";&lt;/pre&gt;In this example, we have an array of three strings, but to access elements of the array we actually subtract one. Now, if we were to try and access strArray[3], we'd be accessing the fourth element. This will case an ArrayOutOfBoundsException to be thrown - the most obvious sign of forgetting the zero-indexing rule.&lt;br /&gt;
Other areas where zero-indexing can get you into trouble is with strings. Suppose you wanted to get a character at a particular offset within a string. Using the String.charAt(int) function you can look this information up - but under Java, the String class is also zero-indexed. That means than the first character is at offset 0, and second at offset 1. You can run into some very frustrating problems unless you are aware of this - particularly if you write applications with heavy string processing. You can be working on the wrong character, and also throw exceptions at run-time. Just like the ArrayOutOfBoundsException, there is a string equivalent. Accessing beyond the bounds of a String will cause a StringIndexOutOfBoundsException to be thrown, as demonstrated by this example.&lt;br /&gt;
&lt;pre&gt;public class StrDemo
{
 public static void main (String args[])
 {
        String abc = "abc";

        System.out.println ("Char at offset 0 : " + abc.charAt(0) );
        System.out.println ("Char at offset 1 : " + abc.charAt(1) );
        System.out.println ("Char at offset 2 : " + abc.charAt(2) );

 // This line should throw a StringIndexOutOfBoundsException
        System.out.println ("Char at offset 3 : " + abc.charAt(3) );
 }
}&lt;/pre&gt;Note too, that zero-indexing doesn't just apply to arrays, or to Strings. Other parts of Java are also indexed, but not always consistently. The java.util.Date, and java.util.Calendar classes start their months with 0, but days start normally with 1. This problem is demonstrated by the following application.&lt;br /&gt;
&lt;pre&gt;import java.util.Date;
import java.util.Calendar;

public class ZeroIndexedDate
{
        public static void main (String args[])
        {
                // Get today's date
                Date today = new Date();
 
  // Print return value of getMonth
  System.out.println ("Date.getMonth() returns : " +
    today.getMonth());

  // Get today's date using a Calendar
  Calendar rightNow = Calendar.getInstance();

  // Print return value of get ( Calendar.MONTH )
  System.out.println ("Calendar.get (month) returns : " +
   rightNow.get ( Calendar.MONTH ));&lt;/pre&gt;&lt;pre&gt;}
}&lt;/pre&gt;Zero-indexing is only a problem if you don't realize that its occurring. If you think you're running into a problem, always consult your API documentation.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;3. Preventing concurrent access to shared variables by threads&lt;/h3&gt;When writing multi-threaded applications, many programmers (myself included) often cut corners, and leave their applications and applets vulnerable to thread conflicts. When two or more threads access the same data concurrently, there exists the possibility (and Murphy's law holding, the probability) that two threads will access or modify the same data at the same time. Don't be fooled into thinking that such problems won't occur on single-threaded processors. While accessing some data (performing a read), your thread may be suspended, and another thread scheduled. It writes its data, which is then overwritten when the first thread makes its changes.&lt;br /&gt;
Such problems are not just limited to multi-threaded applications or applets. If you write Java APIs, or JavaBeans, then your code may not be thread-safe. Even if you never write a single application that uses threads, people that use your code WILL. For the sanity of others, if not yourself, you should always take precautions to prevent concurrent access to shared data.&lt;br /&gt;
How can this problem be solved? The simplest method is to make your variables private (but you do that already,&amp;nbsp; right?) and to use synchronized accessor methods. Accessor methods allow access to private member variables, but in a controlled manner. Take the following accessor methods, which provide a safe way to change the value of a counter.&lt;br /&gt;
&lt;pre&gt;public class MyCounter
{
 private int count = 0; // count starts at zero

 public synchronized void setCount(int amount)
 { 
  count = amount;
 }
 
 public synchronized int getCount()
 {
  return count;
 }
}&lt;/pre&gt;&lt;h3&gt;2. Capitalization errors&lt;/h3&gt;This is one of the most frequent errors that we all make. It's so simple to do, and sometimes one can look at an uncapitalized variable or method and still not spot the problem. I myself have often been puzzled by these errors, because I recognize that the method or variable does exist, but don't spot the lack of capitalization.&lt;br /&gt;
While there's no silver bullet for detecting this error, you can easily train yourself to make less of them. There's a very simple trick you can learn :-&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;all methods and member variables in the Java API begin with lowercase letters&lt;/li&gt;
&lt;li&gt;all methods and member variables use capitalization where a new word begins e.g - getDoubleValue()&lt;/li&gt;
&lt;/ul&gt;If you use this pattern for all of your member variables and classes, and then make a conscious effort to get it right, you can gradually reduce the number of mistakes you'll make. It may take a while, but it can save some serious head scratching in the future.&lt;br /&gt;
&lt;h2 align="center"&gt;(drum roll)&lt;/h2&gt;&lt;h2 align="center"&gt;And the number one error that Java programmers make !!!!!&lt;/h2&gt;&lt;br /&gt;
&lt;h1 align="center"&gt;1. Null pointers!&lt;/h1&gt;Null pointers are one of the most common errors that Java programmers make. Compilers can't check this one for you - it will only surface at runtime, and if you don't discover it, your users certainly will.&lt;br /&gt;
When an attempt to access an object is made, and the reference to that object is null, a NullPointerException will be thrown. The cause of null pointers can be varied, but generally it means that either you haven't initialized an object, or you haven't checked the return value of a function.&lt;br /&gt;
Many functions return null to indicate an error condition - but unless you check your return values, you'll never know what's happening. Since the cause is an error condition, normal testing may not pick it up - which means that your users will end up discovering the problem for you. If the API function indicates that null may be returned, be sure to check this before using the object reference!&lt;br /&gt;
Another cause is where your initialization has been sloppy, or where it is conditional. For example, examine the following code, and see if you can spot the problem.&lt;br /&gt;
&lt;pre&gt;public static void main(String args[])
{
 // Accept up to 3 parameters
 String[] list = new String[3];

 int index = 0;

 while ( (index &amp;lt; args.length) &amp;amp;&amp;amp; ( index &amp;lt; 3 ) )
 {
  list[index++] = args[index];
 }

 // Check all the parameters 
 for (int i = 0; i &amp;lt; list.length; i++)
 {
  if (list[i].equals "-help")
  {
   // .........
  }
  else
  if (list[i].equals "-cp")
  {
   // .........
  }
  // else .....
 } 
}&lt;/pre&gt;This code (while a contrived example), shows a common mistake. Under some circumstances, where the user enters three or more parameters, the code will run fine. If no parameters are entered, you'll get a NullPointerException at runtime. Sometimes your variables (the array of strings) will be initialized, and other times they won't. One easy solution is to check BEFORE you attempt to access a variable in an array that it is not equal to null.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Summary&lt;/h3&gt;These errors represent but some of the many that we all make. Though it is impossible to completely eliminate errors from the coding process, with care and practice you can avoid repeating the same ones. Rest assured, however, that all Java programmers encounter the same sorts of problems. It's comforting to know, that while you work late into the night tracking down an error, someone, somewhere, sometime, will make the same mistake!&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.javacoffeebreak.com/articles/toptenerrors.html"&gt;&lt;span class="Apple-style-span" style="font-size: xx-small;"&gt;Source : javacoffeebreak&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/499460786565996554-6979959436679978607?l=java.chankeypathak.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/iSbPI9nYjWVqsnkaaXvE-mYrTLY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/iSbPI9nYjWVqsnkaaXvE-mYrTLY/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/iSbPI9nYjWVqsnkaaXvE-mYrTLY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/iSbPI9nYjWVqsnkaaXvE-mYrTLY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://java.chankeypathak.com/feeds/6979959436679978607/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://java.chankeypathak.com/2011/01/top-10-errors-java-programmers-make.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/6979959436679978607?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/6979959436679978607?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaIsTheFuture/~3/4DTdZT61jQM/top-10-errors-java-programmers-make.html" title="Top 10 errors java programmers make" /><author><name>Chankey Pathak</name><uri>http://www.blogger.com/profile/04990026893506195372</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://1.bp.blogspot.com/_QaES48F1VIg/TRBKsmJYKTI/AAAAAAAAAkg/Evavac_bHNc/S220/100_5098.JPG" /></author><thr:total>2</thr:total><feedburner:origLink>http://java.chankeypathak.com/2011/01/top-10-errors-java-programmers-make.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CE8ESH05fCp7ImA9WhdQFU8.&quot;"><id>tag:blogger.com,1999:blog-499460786565996554.post-7567126702508742669</id><published>2010-12-05T13:20:00.002+05:30</published><updated>2011-08-17T00:56:49.324+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-17T00:56:49.324+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SCJP/OCJP" /><category scheme="http://www.blogger.com/atom/ns#" term="General" /><title>Top 5 reasons that make SCJP Certification Exam tough</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span class="Apple-style-span" style="color: #222222; font-family: Georgia, Times, 'Times New Roman', serif; font-size: 14px; line-height: 20px;"&gt;&lt;span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-size: 14px; font-style: inherit; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;1.You are not in reality of the exam preparation&lt;/span&gt;&lt;br /&gt;
Most of the time preparation for this certification exam is approached in the conventional style especially the way you did preparation back in school and college days. However the reality of this exam is that you are no longer in school or in college (some exceptions maybe there) you are in a full time job and you have to manage job responsibilities and also are going to study after a break. Hence the preparation approach must be also different.&lt;br /&gt;
&lt;span id="the-content" style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-size: 14px; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;code style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-size: 14px; font-style: inherit; font-weight: inherit; font: normal normal normal 1em/normal 'andale mono', 'lucida console', monospace; line-height: 1.5; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;span class="fullpost" style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-size: 14px; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-size: 14px; font-style: inherit; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;Solution :&lt;/span&gt;&amp;nbsp;Plan ahead&lt;br /&gt;
Rather than beating yourself up for not studying the way you did earlier design a new approach as the circumstances are different now. Make a study plan keeping the reality of the current circumstance in mind.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-size: 14px; font-style: inherit; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;2.You only prepare theoretical aspects of the exam&lt;/span&gt;&lt;br /&gt;
The SCJP exam now-a-days having more coding questions. Small code snippets are given and either with compilation errors or code logic errors need to be answered.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-size: 14px; font-style: inherit; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;Solution :&lt;/span&gt;&amp;nbsp;Practice practice practice...&lt;br /&gt;
SCJP questions can be best answered if you have done hands on programming in Java and if not then you will need to practise many such questions that give you exposure of coding. Look for mock tests/sample practise tests that have you practise a lot of coding.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-size: 14px; font-style: inherit; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;3.Preparing Alone&lt;/span&gt;&lt;br /&gt;
Preparing for the certification exam alone is a trap you will never be able to study alone as you have never done that in school/college etc you had your entire class friends preparing with you.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-size: 14px; font-style: inherit; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;Solution :&lt;/span&gt;&amp;nbsp;get a group of committed people to take the exam with you&lt;br /&gt;
Get a friend/colleague or register in a Java forum to belong to a group of people and prepare along with them. Not only will it be fun but it" also give you the required competition and keep you on your toes.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-size: 14px; font-style: inherit; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;4.Nothing happens over night&lt;/span&gt;&lt;br /&gt;
You might have heard of this great person in your office who passed the exam in 1 week or 1 month and now you are impatient as to how long it will take for you to be certified&lt;a href="http://sunjavasnips.blogspot.com/2009/11/top-5-reasons-that-make-scjp.html"&gt;.&lt;/a&gt; You plan for 1 month and soon the plan goes to the dogs so now you are really impatient and in your mind you have made it a very tough exam that will take lots to pass.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-size: 14px; font-style: inherit; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;Solution :&amp;nbsp;&lt;/span&gt;Build brick by Brick&lt;br /&gt;
Don't try to learn the entire language in a week/month, take your time. Keep the objective of learning and not just somehow passing the certification exam. Learn "why" something works a given way, not just that it works one way. This will surely see you long way in your journey as a Java professional.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-size: 14px; font-style: inherit; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;5. Am I ready to take the test?&lt;/span&gt;&lt;br /&gt;
This is a tough one to answer. And exam will always be an exam meaning it will always give butterfly in your stomach and make you feel like throwing up the moment you think of taking the exam.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-size: 14px; font-style: inherit; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;Solution :&lt;/span&gt;&amp;nbsp;Don"t be guided by you feelings&lt;br /&gt;
Here again I will point to the first point, keep in touch with the reality of your exam preparation. Let the scores in the practise tests/mock tests guide you whether you are ready for the exam or not. If you are scoring 85% + in the mock tests do go take the exam.&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/499460786565996554-7567126702508742669?l=java.chankeypathak.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/8mf70wugchF0viOt2Bsr0-myy_w/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8mf70wugchF0viOt2Bsr0-myy_w/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/8mf70wugchF0viOt2Bsr0-myy_w/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8mf70wugchF0viOt2Bsr0-myy_w/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://java.chankeypathak.com/feeds/7567126702508742669/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://java.chankeypathak.com/2010/12/top-5-reasons-that-make-scjp.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/7567126702508742669?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/7567126702508742669?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaIsTheFuture/~3/hDLNonRfV3w/top-5-reasons-that-make-scjp.html" title="Top 5 reasons that make SCJP Certification Exam tough" /><author><name>Chankey Pathak</name><uri>http://www.blogger.com/profile/04990026893506195372</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://1.bp.blogspot.com/_QaES48F1VIg/TRBKsmJYKTI/AAAAAAAAAkg/Evavac_bHNc/S220/100_5098.JPG" /></author><thr:total>0</thr:total><feedburner:origLink>http://java.chankeypathak.com/2010/12/top-5-reasons-that-make-scjp.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0ADR34_fCp7ImA9Wx9SE0k.&quot;"><id>tag:blogger.com,1999:blog-499460786565996554.post-1356058938059645225</id><published>2010-12-03T07:20:00.003+05:30</published><updated>2010-12-03T07:32:56.044+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-12-03T07:32:56.044+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Quiz of the day" /><title>Quiz of the Day | December 3, 2010</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_QaES48F1VIg/TPhMhuKN2DI/AAAAAAAAAkE/UE75dUDf910/s1600/149865_471698719340_201821239340_5412654_5594718_n.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="193" src="http://1.bp.blogspot.com/_QaES48F1VIg/TPhMhuKN2DI/AAAAAAAAAkE/UE75dUDf910/s320/149865_471698719340_201821239340_5412654_5594718_n.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;What will be the output when you compile and execute the following program?&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;Choose one answer.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;a. Prints true&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;b. Prints false&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;c. Prints 9&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;d. Prints 2&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;e. Compiler error : Incorrect declaration of main method&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;f. None of these&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;Solution :&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;Choice F is the correct answer.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;The code does not compile because the &amp;amp;&amp;amp; operator works only with boolean operands. If both operands are true, the &amp;amp;&amp;amp; operator returns true and false in all the other cases. In this case, integer operands are&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;&lt;span class="text_exposed_show" style="display: inline;"&gt;passed to the &amp;amp;&amp;amp; operator, so the code does not compile. Since the code does not compile, choices A to D are incorrect.&lt;br /&gt;
&lt;br /&gt;
Choice E is incorrect because there is nothing wrong with the declaration of the main method. The modifiers public and static can appear in any order. Also, the main method takes a String[] as the argument.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif;"&gt;&lt;span class="text_exposed_show" style="display: inline;"&gt;&lt;span class="Apple-style-span" style="font-size: xx-small;"&gt;Source : "&lt;a href="http://www.facebook.com/scjp.exam"&gt;Facebook Community&lt;/a&gt;"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/499460786565996554-1356058938059645225?l=java.chankeypathak.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ZsOOOpYCcqY-MGrvEnd5RprvqCg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ZsOOOpYCcqY-MGrvEnd5RprvqCg/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/ZsOOOpYCcqY-MGrvEnd5RprvqCg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ZsOOOpYCcqY-MGrvEnd5RprvqCg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://java.chankeypathak.com/feeds/1356058938059645225/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://java.chankeypathak.com/2010/12/quiz-of-day-december-3-2010.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/1356058938059645225?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/1356058938059645225?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaIsTheFuture/~3/7MQoMJ7fufA/quiz-of-day-december-3-2010.html" title="Quiz of the Day | December 3, 2010" /><author><name>Chankey Pathak</name><uri>http://www.blogger.com/profile/04990026893506195372</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://1.bp.blogspot.com/_QaES48F1VIg/TRBKsmJYKTI/AAAAAAAAAkg/Evavac_bHNc/S220/100_5098.JPG" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_QaES48F1VIg/TPhMhuKN2DI/AAAAAAAAAkE/UE75dUDf910/s72-c/149865_471698719340_201821239340_5412654_5594718_n.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://java.chankeypathak.com/2010/12/quiz-of-day-december-3-2010.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkQBRX87fip7ImA9Wx9TE0U.&quot;"><id>tag:blogger.com,1999:blog-499460786565996554.post-5283756087227152259</id><published>2010-11-22T06:29:00.004+05:30</published><updated>2010-11-22T06:42:34.106+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-22T06:42:34.106+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Source code" /><category scheme="http://www.blogger.com/atom/ns#" term="Programs(Moderate)" /><title>How to obtain from where a Class is loaded</title><content type="html">&lt;script src="http://pastie.org/1316311.js"&gt;
&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
Source : &lt;a href=http://goo.gl/d2JFD&gt;"rgagnon.com"&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/499460786565996554-5283756087227152259?l=java.chankeypathak.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/UPAvO7hrWG_qo5K5d5MTdIMlx68/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/UPAvO7hrWG_qo5K5d5MTdIMlx68/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/UPAvO7hrWG_qo5K5d5MTdIMlx68/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/UPAvO7hrWG_qo5K5d5MTdIMlx68/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://java.chankeypathak.com/feeds/5283756087227152259/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://java.chankeypathak.com/2010/11/how-to-obtain-from-where-class-is.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/5283756087227152259?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/5283756087227152259?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaIsTheFuture/~3/G3HCRiF7z4g/how-to-obtain-from-where-class-is.html" title="How to obtain from where a Class is loaded" /><author><name>Chankey Pathak</name><uri>http://www.blogger.com/profile/04990026893506195372</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://1.bp.blogspot.com/_QaES48F1VIg/TRBKsmJYKTI/AAAAAAAAAkg/Evavac_bHNc/S220/100_5098.JPG" /></author><thr:total>0</thr:total><feedburner:origLink>http://java.chankeypathak.com/2010/11/how-to-obtain-from-where-class-is.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0IBQHY4eip7ImA9Wx9SE0k.&quot;"><id>tag:blogger.com,1999:blog-499460786565996554.post-3307533700117270408</id><published>2010-11-07T03:22:00.003+05:30</published><updated>2010-12-03T07:29:11.832+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-12-03T07:29:11.832+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Questions/Answers" /><category scheme="http://www.blogger.com/atom/ns#" term="Puzzle" /><category scheme="http://www.blogger.com/atom/ns#" term="Quiz of the day" /><title>Quiz of the Day | November 7, 2010</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_QaES48F1VIg/TNXN7xjI8XI/AAAAAAAAAj0/KZyGxnC3KIU/s1600/7.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="312" src="http://3.bp.blogspot.com/_QaES48F1VIg/TNXN7xjI8XI/AAAAAAAAAj0/KZyGxnC3KIU/s320/7.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;What will happen when you attempt to compile and run the above code? (Assume that the code is compiled and run with assertions enabled.)&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;a. It will print odd and even numbers from 0 to 9 correctly (0 even and 1 odd).&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;b. It will print odd and even numbers from 0 to 9 incorrectly (0 odd and 1 even).&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;c. Compilation error at line 9.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;d. Compilation error at line 10.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;e. It will result in an infinite loop.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;Solution :&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;Choice A is the correct answer.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;The code will compile successfully and it will print odd and even numbers from 0 to 9 correctly, without reversing even and odd.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;Let's look at the execution of the code. The assert statement at line 9 asserts t&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;&lt;span class="text_exposed_show" style="display: inline;"&gt;hat "i%2==0" must be true, which will be true for all the even numbers in the range 0 to 9 (0, 2, 4, 6, and 8), and false for all the odd numbers in the range 0 to 9 (1, 3, 5, 7, and 9). When the assert statement is evaluated to true, the second expression on the right hand side of the colon is not evaluated. On the other hand, when the assert statement is evaluated to false, the expression on the right hand side of the colon is evaluated and an AssertionError is thrown.&lt;br /&gt;
&lt;br /&gt;
When the for loop starts with i=0, the assert condition at line 9 is evaluated to true, hence the other expression i-- is not evaluated, the value of i (0 here) is printed at line 10. Next, i is incremented to 1 in the next iteration of the for loop. The assert condition at line 9 is false in this case, hence the expression i--is evaluated (i becomes 0) and an AssertionError is thrown. The print statement at line 10 is not executed in this case. The catch statement at line 12 catches this error and the print statement at line 14 increments i with ++i and prints its value (which is 1 in this case). The same process is repeated for all the numbers, thus effectively printing all the even and odd number correctly.&lt;br /&gt;
&lt;br /&gt;
The key here lies in understanding when the right-hand side expression of an assert statement gets evaluated. It gets evaluated *only* when the boolean left-hand side expression is evaluated to false. Hence, the loop will not result in an infinite loop.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: xx-small;"&gt;Source : &lt;a href="http://www.facebook.com/scjp.exam"&gt;"Facebook community"&lt;/a&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/499460786565996554-3307533700117270408?l=java.chankeypathak.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/jZyno5AYg6LrS2HhDBBdsEHPUJI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/jZyno5AYg6LrS2HhDBBdsEHPUJI/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/jZyno5AYg6LrS2HhDBBdsEHPUJI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/jZyno5AYg6LrS2HhDBBdsEHPUJI/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://java.chankeypathak.com/feeds/3307533700117270408/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://java.chankeypathak.com/2010/11/quiz-of-day-november-7-2010.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/3307533700117270408?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/3307533700117270408?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaIsTheFuture/~3/92u0nhe2_lo/quiz-of-day-november-7-2010.html" title="Quiz of the Day | November 7, 2010" /><author><name>Chankey Pathak</name><uri>http://www.blogger.com/profile/04990026893506195372</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://1.bp.blogspot.com/_QaES48F1VIg/TRBKsmJYKTI/AAAAAAAAAkg/Evavac_bHNc/S220/100_5098.JPG" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_QaES48F1VIg/TNXN7xjI8XI/AAAAAAAAAj0/KZyGxnC3KIU/s72-c/7.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://java.chankeypathak.com/2010/11/quiz-of-day-november-7-2010.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A04MRn86eSp7ImA9Wx5aEE4.&quot;"><id>tag:blogger.com,1999:blog-499460786565996554.post-327490947004796610</id><published>2010-11-06T13:02:00.003+05:30</published><updated>2010-11-06T16:09:47.111+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-06T16:09:47.111+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Questions/Answers" /><category scheme="http://www.blogger.com/atom/ns#" term="General" /><title>Converting a 2d array of ints to char and string in Java</title><content type="html">&lt;b&gt;Question &lt;/b&gt;:&amp;nbsp;&lt;span class="Apple-style-span" style="border-collapse: collapse; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;"&gt;How can i convert the ints in a 2d array into chars, and strings?&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="border-collapse: collapse; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; font-size: 14px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;"&gt;If i copy ints to a char array i just get the ascii code.&lt;/span&gt;&lt;/div&gt;&lt;div style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; font-size: 14px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;"&gt;For example&lt;/span&gt;&lt;/div&gt;&lt;div style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; font-size: 14px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;"&gt;public int a[5][5]&lt;/span&gt;&lt;/div&gt;&lt;div style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; font-size: 14px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;"&gt;//some code&lt;/span&gt;&lt;/div&gt;&lt;div style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; font-size: 14px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;"&gt;public String b[5][5] = public int a[5][5]&lt;/span&gt;&lt;/div&gt;&lt;div style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; font-size: 14px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;"&gt;&lt;b&gt;Answer &lt;/b&gt;:&amp;nbsp;Quite frankly, the easiest approach would simply leave your array as-is... and convert&amp;nbsp;&lt;code style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1px; padding-left: 5px; padding-right: 5px; padding-top: 1px; vertical-align: baseline;"&gt;int&lt;/code&gt;&amp;nbsp;values to&lt;code style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1px; padding-left: 5px; padding-right: 5px; padding-top: 1px; vertical-align: baseline;"&gt;String&lt;/code&gt;'s when you use them:&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre class="prettyprint" style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; max-height: 600px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; vertical-align: baseline; width: auto;"&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;"&gt;&lt;code style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;span class="typ" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #2b91af; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;Integer&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;.&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;toString&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;(&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;a&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;[&lt;/span&gt;&lt;span class="lit" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;5&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;][&lt;/span&gt;&lt;span class="lit" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;5&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;]);&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; font-size: 14px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;"&gt;Alternatively, you could start with a&amp;nbsp;&lt;code style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1px; padding-left: 5px; padding-right: 5px; padding-top: 1px; vertical-align: baseline;"&gt;String[][]&lt;/code&gt;&amp;nbsp;array in the first place, and simply convert your&amp;nbsp;&lt;code style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1px; padding-left: 5px; padding-right: 5px; padding-top: 1px; vertical-align: baseline;"&gt;int&lt;/code&gt;values to&amp;nbsp;&lt;code style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1px; padding-left: 5px; padding-right: 5px; padding-top: 1px; vertical-align: baseline;"&gt;String&lt;/code&gt;&amp;nbsp;when adding them:&lt;/span&gt;&lt;/div&gt;&lt;pre class="prettyprint" style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; max-height: 600px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; vertical-align: baseline; width: auto;"&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;"&gt;&lt;code style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;a&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;[&lt;/span&gt;&lt;span class="lit" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;5&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;][&lt;/span&gt;&lt;span class="lit" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;5&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;]&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;=&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="kwd" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: darkblue; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;new&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="typ" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #2b91af; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;String&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;(&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;myInt&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;);&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; font-size: 14px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;"&gt;If you really do need to convert an array of type&amp;nbsp;&lt;code style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1px; padding-left: 5px; padding-right: 5px; padding-top: 1px; vertical-align: baseline;"&gt;int[][]&lt;/code&gt;&amp;nbsp;to one of type&amp;nbsp;&lt;code style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1px; padding-left: 5px; padding-right: 5px; padding-top: 1px; vertical-align: baseline;"&gt;String[][]&lt;/code&gt;, you would have to do so manually with a two-layer&amp;nbsp;&lt;code style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1px; padding-left: 5px; padding-right: 5px; padding-top: 1px; vertical-align: baseline;"&gt;for()&lt;/code&gt;&amp;nbsp;loop:&lt;/span&gt;&lt;/div&gt;&lt;pre class="prettyprint" style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; max-height: 600px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; vertical-align: baseline; width: auto;"&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;"&gt;&lt;code style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;span class="typ" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #2b91af; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;String&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;[][]&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; converted &lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;=&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="kwd" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: darkblue; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;new&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="typ" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #2b91af; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;String&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;[&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;a&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;.&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;length&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;][];&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;
&lt;/span&gt;&lt;span class="kwd" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: darkblue; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;for&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;(&lt;/span&gt;&lt;span class="kwd" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: darkblue; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;int&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; index &lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;=&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="lit" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;0&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;;&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; index &lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&amp;lt;&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; a&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;.&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;length&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;;&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; index&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;++)&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;{&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;
&amp;nbsp; &amp;nbsp; converted&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;[&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;index&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;]&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;=&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="kwd" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: darkblue; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;new&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="typ" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #2b91af; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;String&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;[&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;a&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;[&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;index&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;].&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;length&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;];&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;
&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="kwd" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: darkblue; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;for&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;(&lt;/span&gt;&lt;span class="kwd" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: darkblue; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;int&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; subIndex &lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;=&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="lit" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;0&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;;&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; subIndex &lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&amp;lt;&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; a&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;[&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;index&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;].&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;length&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;;&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; subIndex&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;++){&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; converted&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;[&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;index&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;][&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;subIndex&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;]&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;=&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="typ" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #2b91af; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;Integer&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;.&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;toString&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;(&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;a&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;[&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;index&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;][&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;subIndex&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;]);&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;
&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;}&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;
&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;}&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;&lt;div style="font-size: 14px;"&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;"&gt;All three of these approaches would work equally well for conversion to type&amp;nbsp;&lt;code style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1px; padding-left: 5px; padding-right: 5px; padding-top: 1px; vertical-align: baseline;"&gt;char&lt;/code&gt;&amp;nbsp;rather than&lt;code style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1px; padding-left: 5px; padding-right: 5px; padding-top: 1px; vertical-align: baseline;"&gt;String&lt;/code&gt;.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-size: 14px;"&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 18px;"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Source : &lt;a href="http://stackoverflow.com/questions/4033888/converting-a-2d-array-of-ints-to-char-and-string-in-java"&gt;Stack-Overflow&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/499460786565996554-327490947004796610?l=java.chankeypathak.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/-pe9VOPNJBJv8wC7QYCoZFPvmOY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/-pe9VOPNJBJv8wC7QYCoZFPvmOY/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/-pe9VOPNJBJv8wC7QYCoZFPvmOY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/-pe9VOPNJBJv8wC7QYCoZFPvmOY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://java.chankeypathak.com/feeds/327490947004796610/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://java.chankeypathak.com/2010/11/converting-2d-array-of-ints-to-char-and.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/327490947004796610?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/327490947004796610?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaIsTheFuture/~3/QysxnCz8_sQ/converting-2d-array-of-ints-to-char-and.html" title="Converting a 2d array of ints to char and string in Java" /><author><name>Chankey Pathak</name><uri>http://www.blogger.com/profile/04990026893506195372</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://1.bp.blogspot.com/_QaES48F1VIg/TRBKsmJYKTI/AAAAAAAAAkg/Evavac_bHNc/S220/100_5098.JPG" /></author><thr:total>0</thr:total><feedburner:origLink>http://java.chankeypathak.com/2010/11/converting-2d-array-of-ints-to-char-and.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0IMSHc-cSp7ImA9Wx9SE0k.&quot;"><id>tag:blogger.com,1999:blog-499460786565996554.post-1512898294376051598</id><published>2010-11-06T01:20:00.006+05:30</published><updated>2010-12-03T07:29:49.959+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-12-03T07:29:49.959+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Questions/Answers" /><category scheme="http://www.blogger.com/atom/ns#" term="Puzzle" /><category scheme="http://www.blogger.com/atom/ns#" term="Quiz of the day" /><title>Quiz of the Day | November 6, 2010</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_QaES48F1VIg/TNRf7LT6iZI/AAAAAAAAAjs/fMvYrQBb_3I/s1600/6.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="310" src="http://1.bp.blogspot.com/_QaES48F1VIg/TNRf7LT6iZI/AAAAAAAAAjs/fMvYrQBb_3I/s320/6.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;What value is printed out by executing the above code?&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;a. 2.7&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;b. 1.7&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;c. 0.0&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;d. -1.0&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;Solution :&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;Choice A is the correct answer.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;In Java, all parameters are passed by value. In case of primitives, the copy of the variable is passed, while in case of object references,&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;it's the copy of the reference that is passed.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;When the argument is a&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;&lt;span class="text_exposed_show" style="display: inline;"&gt;&amp;nbsp;primitive type, pass-by-value means that the method can change the value of the passed argument (in the method scope) but, the called method cannot change the value of the variable in the calling method.&lt;br /&gt;
&lt;br /&gt;
When the argument is of reference type, pass-by-value means that the method cannot change the object reference, but can invoke the object's methods and modify the accessible variables within the object.&lt;br /&gt;
&lt;br /&gt;
In the example above, d is passed as value, hence the change done in the doMinus() method doesn't reflect on d outside the doMinus() method. Thus, the value printed is 2.7&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: xx-small;"&gt;Source : &lt;a href="http://www.facebook.com/scjp.exam"&gt;"Facebook community"&lt;/a&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/499460786565996554-1512898294376051598?l=java.chankeypathak.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/pIJCZYUTMX8TVi7TBM274x8q1Uc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/pIJCZYUTMX8TVi7TBM274x8q1Uc/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/pIJCZYUTMX8TVi7TBM274x8q1Uc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/pIJCZYUTMX8TVi7TBM274x8q1Uc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://java.chankeypathak.com/feeds/1512898294376051598/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://java.chankeypathak.com/2010/11/quiz-of-day-november-6-2010.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/1512898294376051598?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/1512898294376051598?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaIsTheFuture/~3/copcn5VT9CE/quiz-of-day-november-6-2010.html" title="Quiz of the Day | November 6, 2010" /><author><name>Chankey Pathak</name><uri>http://www.blogger.com/profile/04990026893506195372</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://1.bp.blogspot.com/_QaES48F1VIg/TRBKsmJYKTI/AAAAAAAAAkg/Evavac_bHNc/S220/100_5098.JPG" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_QaES48F1VIg/TNRf7LT6iZI/AAAAAAAAAjs/fMvYrQBb_3I/s72-c/6.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://java.chankeypathak.com/2010/11/quiz-of-day-november-6-2010.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkIFQn47fCp7ImA9Wx9TE0U.&quot;"><id>tag:blogger.com,1999:blog-499460786565996554.post-8485872386473908529</id><published>2010-11-05T17:03:00.003+05:30</published><updated>2010-11-22T06:45:13.004+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-22T06:45:13.004+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Questions/Answers" /><category scheme="http://www.blogger.com/atom/ns#" term="Puzzle" /><category scheme="http://www.blogger.com/atom/ns#" term="Quiz of the day" /><title>Quiz of the Day | November 5, 2010 [2]</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_QaES48F1VIg/TNPrLVUrZEI/AAAAAAAAAjo/eKHfEDK02M4/s1600/6.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="297" src="http://1.bp.blogspot.com/_QaES48F1VIg/TNPrLVUrZEI/AAAAAAAAAjo/eKHfEDK02M4/s320/6.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;What will be printed on standard output if the following class is executed using the command "java Test 1 two 3" ?&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: black; font-family: 'Times New Roman'; font-size: medium; line-height: normal;"&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;a. 1&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: black; font-family: 'Times New Roman'; font-size: medium; line-height: normal;"&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;b. two&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;c. NumberFormatException&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;d. ArrayIndexOutOfBoundsException&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;e. Code does not compile&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;Solution :&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;Choice C is the correct answer.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;In Java, command line arguments are stored in the args array which is an argument to the main method. The index of the args array starts with 0 and the first command line argument is the word after the class&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;&lt;span class="text_exposed_show" style="display: inline;"&gt;name. Thus, args[0] will be 1 and args[1] will be "two".&lt;br /&gt;
&lt;br /&gt;
The parseInt() method of the Integer class parses the String argument to the int type. The String passed to the parseInt() method should have only digits, with an exception that it can start with '-' to indicate a negative number. Otherwise, NumberFormatException will be thrown. Thus, when "two" is passed to the parseInt() method, NumberFormatException will be thrown.&lt;br /&gt;
&lt;br /&gt;
Please note that there is nothing wrong with the definition of main, the static word can come after or before public keyword.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Source : &lt;a href=http://www.facebook.com/scjp.exam&gt;"Facebook community"&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/499460786565996554-8485872386473908529?l=java.chankeypathak.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/m9S-E2Yg7yOKGm9FYaidAMhm3V8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/m9S-E2Yg7yOKGm9FYaidAMhm3V8/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/m9S-E2Yg7yOKGm9FYaidAMhm3V8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/m9S-E2Yg7yOKGm9FYaidAMhm3V8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://java.chankeypathak.com/feeds/8485872386473908529/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://java.chankeypathak.com/2010/11/quiz-of-day-november-5-2010-2.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/8485872386473908529?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/8485872386473908529?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaIsTheFuture/~3/VzCZlQn08H8/quiz-of-day-november-5-2010-2.html" title="Quiz of the Day | November 5, 2010 [2]" /><author><name>Chankey Pathak</name><uri>http://www.blogger.com/profile/04990026893506195372</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://1.bp.blogspot.com/_QaES48F1VIg/TRBKsmJYKTI/AAAAAAAAAkg/Evavac_bHNc/S220/100_5098.JPG" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_QaES48F1VIg/TNPrLVUrZEI/AAAAAAAAAjo/eKHfEDK02M4/s72-c/6.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://java.chankeypathak.com/2010/11/quiz-of-day-november-5-2010-2.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkIFRno-cCp7ImA9Wx9TE0U.&quot;"><id>tag:blogger.com,1999:blog-499460786565996554.post-8730147578597676729</id><published>2010-11-05T16:54:00.005+05:30</published><updated>2010-11-22T06:45:17.458+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-22T06:45:17.458+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Questions/Answers" /><category scheme="http://www.blogger.com/atom/ns#" term="Puzzle" /><category scheme="http://www.blogger.com/atom/ns#" term="Quiz of the day" /><title>Quiz of the Day | November 5, 2010</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_QaES48F1VIg/TNRgkJga_SI/AAAAAAAAAjw/uoBUIM4TKeM/s1600/5+(1).jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="316" src="http://1.bp.blogspot.com/_QaES48F1VIg/TNRgkJga_SI/AAAAAAAAAjw/uoBUIM4TKeM/s320/5+(1).jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;What will be the result of compiling the following programs and executing it using the following command - java Child?&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;a. Prints 9&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt; b. Compiler error at line 5&lt;br /&gt;
c. Compiler error at line 6&lt;br /&gt;
d. None of the above&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;Solution :&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;&amp;nbsp;&lt;/span&gt;Choice C is the correct answer.&lt;br /&gt;
&lt;br /&gt;
&lt;span data-jsid="text"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class="text_exposed_root text_exposed" id="id_4cd3e894e83d91007286525" style="display: inline;"&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 11px;"&gt;You cannot access the protected variable in the Parent class from the Child class using the parent class reference. The Child class does inherit the variable x, but it can be accessed only by an object&amp;nbsp;refere&lt;/span&gt;&lt;/span&gt;&lt;span class="text_exposed_show" style="color: #333333; display: inline; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;nce of the Child class. There is no error at line 5. It is legal to refer to a class as packagename.classname even if the package is already imported. So choice B is incorrect.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
Source : &lt;a href=http://www.facebook.com/scjp.exam&gt;"Facebook community"&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/499460786565996554-8730147578597676729?l=java.chankeypathak.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/YPPAvGpUpsDpAqw_ASGmgzJtiQc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/YPPAvGpUpsDpAqw_ASGmgzJtiQc/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/YPPAvGpUpsDpAqw_ASGmgzJtiQc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/YPPAvGpUpsDpAqw_ASGmgzJtiQc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://java.chankeypathak.com/feeds/8730147578597676729/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://java.chankeypathak.com/2010/11/quiz-of-day-november-5-2010.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/8730147578597676729?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/8730147578597676729?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaIsTheFuture/~3/lLIvGXv4wRs/quiz-of-day-november-5-2010.html" title="Quiz of the Day | November 5, 2010" /><author><name>Chankey Pathak</name><uri>http://www.blogger.com/profile/04990026893506195372</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://1.bp.blogspot.com/_QaES48F1VIg/TRBKsmJYKTI/AAAAAAAAAkg/Evavac_bHNc/S220/100_5098.JPG" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_QaES48F1VIg/TNRgkJga_SI/AAAAAAAAAjw/uoBUIM4TKeM/s72-c/5+(1).jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://java.chankeypathak.com/2010/11/quiz-of-day-november-5-2010.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkIGRXg6cCp7ImA9Wx9TE0U.&quot;"><id>tag:blogger.com,1999:blog-499460786565996554.post-628109377980424524</id><published>2010-11-04T01:54:00.003+05:30</published><updated>2010-11-22T06:45:24.618+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-22T06:45:24.618+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Questions/Answers" /><category scheme="http://www.blogger.com/atom/ns#" term="Puzzle" /><category scheme="http://www.blogger.com/atom/ns#" term="Quiz of the day" /><title>Quiz of the Day | November 4, 2010</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_QaES48F1VIg/TNHE3qdT3sI/AAAAAAAAAjU/HF2WuW0zO-A/s1600/4.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="191" src="http://2.bp.blogspot.com/_QaES48F1VIg/TNHE3qdT3sI/AAAAAAAAAjU/HF2WuW0zO-A/s320/4.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;Given the code below, which access modifiers (public, protected, or private) can legally be placed before the myMethod() method on line 3, if no other changes are made to the code? If line 3 is left as it is, which keywords can legally be placed before the myMethod method on line 8?&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;a. private or nothing (default) on line 3. Nothing (default) or protected or public on line 8.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;b. public or protected on line 3. private or nothing (default) on line 8.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;c. Nothing (default) or protected or public on line 3. private or nothing (default) on line 8.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;d. public on line 3 and private on line8.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;Solution :&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;Choice A is the correct answer.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;The basic principle is that a method cannot be overridden to be more private. Since the method is being overridden to be friendly (default access / no modifier), it can only be private or friendly in the super&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;&lt;span class="text_exposed_show" style="display: inline;"&gt;class. Secondly, if the method in superclass is left as it is (i.e., friendly access), the method in subclass can be friendly, protected, or public.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Source : &lt;a href=http://www.facebook.com/scjp.exam&gt;"Facebook community"&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/499460786565996554-628109377980424524?l=java.chankeypathak.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Gcs4OGoYdL4EzBQidFzp8QtLe9c/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Gcs4OGoYdL4EzBQidFzp8QtLe9c/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/Gcs4OGoYdL4EzBQidFzp8QtLe9c/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Gcs4OGoYdL4EzBQidFzp8QtLe9c/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://java.chankeypathak.com/feeds/628109377980424524/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://java.chankeypathak.com/2010/11/quiz-of-day-november-4-2010.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/628109377980424524?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/628109377980424524?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaIsTheFuture/~3/Hsrqfodp71I/quiz-of-day-november-4-2010.html" title="Quiz of the Day | November 4, 2010" /><author><name>Chankey Pathak</name><uri>http://www.blogger.com/profile/04990026893506195372</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://1.bp.blogspot.com/_QaES48F1VIg/TRBKsmJYKTI/AAAAAAAAAkg/Evavac_bHNc/S220/100_5098.JPG" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_QaES48F1VIg/TNHE3qdT3sI/AAAAAAAAAjU/HF2WuW0zO-A/s72-c/4.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://java.chankeypathak.com/2010/11/quiz-of-day-november-4-2010.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkIHQ30-fCp7ImA9Wx9TE0U.&quot;"><id>tag:blogger.com,1999:blog-499460786565996554.post-741283919236685811</id><published>2010-11-03T10:04:00.005+05:30</published><updated>2010-11-22T06:45:32.354+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-22T06:45:32.354+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Questions/Answers" /><category scheme="http://www.blogger.com/atom/ns#" term="Puzzle" /><category scheme="http://www.blogger.com/atom/ns#" term="Quiz of the day" /><title>Quiz of the Day | November 3, 2010</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_QaES48F1VIg/TNDmCVwe_ZI/AAAAAAAAAjQ/jKHo8pVGKNM/s1600/3.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="150" src="http://3.bp.blogspot.com/_QaES48F1VIg/TNDmCVwe_ZI/AAAAAAAAAjQ/jKHo8pVGKNM/s400/3.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;What will be the result of running the following code?&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;a.) The output: Value is - Hello&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;b.) The output: Value is - Hello world&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;c.) A compiler error&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;d.) No output&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;e.) An exception&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;Solution :&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;Choice B is the correct answer.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;Since the OR operator used here is not the short-circuit operator (which is "||"), both operands are evaluated even though the first operand&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;&lt;span class="text_exposed_show" style="display: inline;"&gt;itself is true which guarantees that the whole condition is true. Thus the value of the StringBuffer instance s after the evaluation of the boolean condition is "Hello world" and hence choice B is correct.&lt;br /&gt;
&lt;br /&gt;
Please note here that if we had used "||" operator instead of "|", the correct answer would have been choice A, because in that case the right-hand side operand wouldn't have been evaluated as the left-hand side operand would have been true.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Source : &lt;a href=http://www.facebook.com/scjp.exam&gt;"Facebook community"&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/499460786565996554-741283919236685811?l=java.chankeypathak.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/4RfzNNzwE6TaEw84v0UhOYgBaTM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/4RfzNNzwE6TaEw84v0UhOYgBaTM/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/4RfzNNzwE6TaEw84v0UhOYgBaTM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/4RfzNNzwE6TaEw84v0UhOYgBaTM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://java.chankeypathak.com/feeds/741283919236685811/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://java.chankeypathak.com/2010/11/quiz-of-day-november-3-2010.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/741283919236685811?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/741283919236685811?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaIsTheFuture/~3/EvcfAKSm16k/quiz-of-day-november-3-2010.html" title="Quiz of the Day | November 3, 2010" /><author><name>Chankey Pathak</name><uri>http://www.blogger.com/profile/04990026893506195372</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://1.bp.blogspot.com/_QaES48F1VIg/TRBKsmJYKTI/AAAAAAAAAkg/Evavac_bHNc/S220/100_5098.JPG" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_QaES48F1VIg/TNDmCVwe_ZI/AAAAAAAAAjQ/jKHo8pVGKNM/s72-c/3.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://java.chankeypathak.com/2010/11/quiz-of-day-november-3-2010.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkIHSHsyfip7ImA9Wx9TE0U.&quot;"><id>tag:blogger.com,1999:blog-499460786565996554.post-8490605657870365724</id><published>2010-11-03T09:59:00.002+05:30</published><updated>2010-11-22T06:45:39.596+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-22T06:45:39.596+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Questions/Answers" /><category scheme="http://www.blogger.com/atom/ns#" term="Puzzle" /><category scheme="http://www.blogger.com/atom/ns#" term="Quiz of the day" /><title>Quiz of the Day | November 2, 2010</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_QaES48F1VIg/TNDk_LnWXfI/AAAAAAAAAjM/bFlmQXiTOoQ/s1600/2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="235" src="http://2.bp.blogspot.com/_QaES48F1VIg/TNDk_LnWXfI/AAAAAAAAAjM/bFlmQXiTOoQ/s400/2.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;What will happen when we try to compile the following code?&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;a. The compiler objects to line 3 comparing an Object with an array.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;b. The compiler objects to line 5 casting an Object to an array of int primitives.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;c. The compiler objects to line 11 comparing an Object to an array of Objects.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;d. It compiles without error.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;Solution :&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;Choice D is the correct answer.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;The "instanceof" operator tests the class of an object at runtime. It returns true if the type of the left-hand argument is the same as, or is some subtype of, the class or interface specified by the right-ha&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;&lt;span class="text_exposed_show" style="display: inline;"&gt;nd operand. Arrays are also objects, so they can be referred to by variables of type Object. Hence comparing Object type to array using instanceof is allowed. So choices A, B and C are&amp;nbsp;incorrect.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Source : &lt;a href=http://www.facebook.com/scjp.exam&gt;"Facebook community"&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/499460786565996554-8490605657870365724?l=java.chankeypathak.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/xFVwPm85ibM9B3e6xyLZbDqs68A/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xFVwPm85ibM9B3e6xyLZbDqs68A/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/xFVwPm85ibM9B3e6xyLZbDqs68A/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xFVwPm85ibM9B3e6xyLZbDqs68A/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://java.chankeypathak.com/feeds/8490605657870365724/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://java.chankeypathak.com/2010/11/quiz-of-day-november-2-2010.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/8490605657870365724?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/8490605657870365724?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaIsTheFuture/~3/41klQvSkOyE/quiz-of-day-november-2-2010.html" title="Quiz of the Day | November 2, 2010" /><author><name>Chankey Pathak</name><uri>http://www.blogger.com/profile/04990026893506195372</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://1.bp.blogspot.com/_QaES48F1VIg/TRBKsmJYKTI/AAAAAAAAAkg/Evavac_bHNc/S220/100_5098.JPG" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_QaES48F1VIg/TNDk_LnWXfI/AAAAAAAAAjM/bFlmQXiTOoQ/s72-c/2.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://java.chankeypathak.com/2010/11/quiz-of-day-november-2-2010.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkIARXc-fyp7ImA9Wx9TE0U.&quot;"><id>tag:blogger.com,1999:blog-499460786565996554.post-8711549199743191369</id><published>2010-11-01T02:06:00.001+05:30</published><updated>2010-11-22T06:45:44.957+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-22T06:45:44.957+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Questions/Answers" /><category scheme="http://www.blogger.com/atom/ns#" term="Puzzle" /><category scheme="http://www.blogger.com/atom/ns#" term="Quiz of the day" /><title>Quiz of the Day | November 1, 2010</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_QaES48F1VIg/TM3St7ewgDI/AAAAAAAAAjI/DBcH3Vx0Ce4/s1600/1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/_QaES48F1VIg/TM3St7ewgDI/AAAAAAAAAjI/DBcH3Vx0Ce4/s320/1.jpg" width="314" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;Which of the following statements about the following code fragment are true?&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;a.) The code compiles successfully and displays "Test".&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;b.) Changing the code at line 13 to "public void print(int x)" will allow the code to compile correctly.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;c.) The code fails to compile. The compiler complains about duplicate methods.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;d.) Changing the return type on line 13 from 'void' to 'int' will allow the code to compile correctly.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;Solution :&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;Choices B and C are the correct answers.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;The code appears to be attempting to overload the print() method.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;&lt;span class="text_exposed_show" style="display: inline;"&gt;&lt;br /&gt;
However, the only differentiating feature between the methods is the static keyword. This is insufficient for overloading. Therefore, choice C is correct and choice A is incorrect because the code fails to compile due to duplicate methods.&lt;br /&gt;
&lt;br /&gt;
Choice B is correct because the methods are different overloaded versions of the print() methods.&lt;br /&gt;
&lt;br /&gt;
Choice D is incorrect because the return parameters are not sufficient to differentiate between the overloaded methods.&lt;br /&gt;
&lt;br /&gt;
More about overloading is available at&amp;nbsp;&lt;a href="http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.4.9" rel="nofollow" style="color: #3b5998; cursor: pointer; text-decoration: none;" target="_blank"&gt;&lt;span&gt;http://java.sun.com/docs/b&lt;/span&gt;&lt;wbr&gt;&lt;/wbr&gt;&lt;span class="word_break" style="display: block; float: left; margin-left: -10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;/span&gt;&lt;span&gt;ooks/jls/third_edition/htm&lt;/span&gt;&lt;wbr&gt;&lt;/wbr&gt;&lt;span class="word_break" style="display: block; float: left; margin-left: -10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;/span&gt;l/classes.html#8.4.9&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Source : &lt;a href=http://www.facebook.com/scjp.exam&gt;"Facebook community"&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/499460786565996554-8711549199743191369?l=java.chankeypathak.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/wjKHJlLGCRppvmaziKVxoF6ttHY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wjKHJlLGCRppvmaziKVxoF6ttHY/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/wjKHJlLGCRppvmaziKVxoF6ttHY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wjKHJlLGCRppvmaziKVxoF6ttHY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://java.chankeypathak.com/feeds/8711549199743191369/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://java.chankeypathak.com/2010/11/quiz-of-day-november-1-2010.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/8711549199743191369?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/8711549199743191369?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaIsTheFuture/~3/UD4HlplzT7A/quiz-of-day-november-1-2010.html" title="Quiz of the Day | November 1, 2010" /><author><name>Chankey Pathak</name><uri>http://www.blogger.com/profile/04990026893506195372</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://1.bp.blogspot.com/_QaES48F1VIg/TRBKsmJYKTI/AAAAAAAAAkg/Evavac_bHNc/S220/100_5098.JPG" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_QaES48F1VIg/TM3St7ewgDI/AAAAAAAAAjI/DBcH3Vx0Ce4/s72-c/1.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://java.chankeypathak.com/2010/11/quiz-of-day-november-1-2010.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkIBQX8_cCp7ImA9Wx9TE0U.&quot;"><id>tag:blogger.com,1999:blog-499460786565996554.post-6291169218406559014</id><published>2010-10-31T02:03:00.001+05:30</published><updated>2010-11-22T06:45:50.148+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-22T06:45:50.148+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Questions/Answers" /><category scheme="http://www.blogger.com/atom/ns#" term="Puzzle" /><category scheme="http://www.blogger.com/atom/ns#" term="Quiz of the day" /><title>Quiz of the Day | Oct 31, 2010</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_QaES48F1VIg/TMyAvaoH_KI/AAAAAAAAAjE/v6bF_0f3XYw/s1600/14645_206392044340_201821239340_2875760_6274579_n.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_QaES48F1VIg/TMyAvaoH_KI/AAAAAAAAAjE/v6bF_0f3XYw/s1600/14645_206392044340_201821239340_2875760_6274579_n.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;How many objects will be eligible for garbage collection after the execution of line 9 in the following code?&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;a.) 8&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;b.) 14&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;c.) 15&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;d.) 16&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 11px; line-height: 15px;"&gt;Solution :&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;This code creates 16 objects of type Double. Out of which, 15 Double objects are created by the iterations of the nested for loops at lines 6 and 7, and one more Double object is c&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;&lt;span class="text_exposed_show" style="display: inline;"&gt;reated at line 5. The very first iteration of the loop makes the object created at line 5 eligible for garbage collection. With each iteration of the loop, a new object is created and assigned to 'x', and the old (or previously created) object becomes eligible for garbage collection. Only the most recently created object (for i=4 and j=2) is not eligible for garbage collection.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="text_exposed_show" style="display: inline;"&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 11px;"&gt;Thus, out of the created 16 objects (including the one created at line 5), a total of 15 objects have become eligible for garbage collection after the execution of line 9.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 11px;"&gt;Actually, as explained in the earlier paragraph, each iteration of the loop (line 8) makes the previously created object eligible for garbage collection. Thus, by the time both nested loops finish their execution (before execution of line 9), a total of 15 objects have become eligible for garbage collection. The execution of line 9 itself does not affect garbage collection in any way. Want to know more?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 11px;"&gt;You can read more about garbage collection at -&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;a href="http://java.sun.com/docs/books/performance/1st_edition/html/JPAppGC.fm.html" rel="nofollow" style="color: #3b5998; cursor: pointer; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; text-decoration: none;" target="_blank"&gt;&lt;span&gt;http://java.sun.com/docs/b&lt;/span&gt;&lt;span&gt;ooks/performance/1st_editi&lt;/span&gt;&lt;wbr&gt;&lt;/wbr&gt;&lt;span class="word_break" style="display: block; float: left; margin-left: -10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;/span&gt;on/html/JPAppGC.fm.html&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://www.developer.com/tech/article.php/628881" rel="nofollow" style="color: #3b5998; cursor: pointer; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; text-decoration: none;" target="_blank"&gt;&lt;span&gt;http://www.developer.com/t&lt;/span&gt;&lt;wbr&gt;&lt;/wbr&gt;&lt;span class="word_break" style="display: block; float: left; margin-left: -10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;/span&gt;ech/article.php/628881&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Source : &lt;a href=http://www.facebook.com/scjp.exam&gt;"Facebook community"&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/499460786565996554-6291169218406559014?l=java.chankeypathak.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ZcswQNsF2LBE2mwU5V9tR8HmHiA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ZcswQNsF2LBE2mwU5V9tR8HmHiA/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/ZcswQNsF2LBE2mwU5V9tR8HmHiA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ZcswQNsF2LBE2mwU5V9tR8HmHiA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://java.chankeypathak.com/feeds/6291169218406559014/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://java.chankeypathak.com/2010/10/quiz-of-day-oct-31-2010.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/6291169218406559014?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/6291169218406559014?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaIsTheFuture/~3/rTAD9kZfmVo/quiz-of-day-oct-31-2010.html" title="Quiz of the Day | Oct 31, 2010" /><author><name>Chankey Pathak</name><uri>http://www.blogger.com/profile/04990026893506195372</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://1.bp.blogspot.com/_QaES48F1VIg/TRBKsmJYKTI/AAAAAAAAAkg/Evavac_bHNc/S220/100_5098.JPG" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_QaES48F1VIg/TMyAvaoH_KI/AAAAAAAAAjE/v6bF_0f3XYw/s72-c/14645_206392044340_201821239340_2875760_6274579_n.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://java.chankeypathak.com/2010/10/quiz-of-day-oct-31-2010.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkIBRHc-fCp7ImA9Wx9TE0U.&quot;"><id>tag:blogger.com,1999:blog-499460786565996554.post-3053114154531349712</id><published>2010-10-30T19:37:00.003+05:30</published><updated>2010-11-22T06:45:55.954+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-22T06:45:55.954+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Questions/Answers" /><category scheme="http://www.blogger.com/atom/ns#" term="Puzzle" /><category scheme="http://www.blogger.com/atom/ns#" term="Quiz of the day" /><title>Quiz of the Day | Oct 30, 2010</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_QaES48F1VIg/TMwmNbXtvXI/AAAAAAAAAi8/ehYPQEznYvE/s1600/14645_204779474340_201821239340_2870631_4663381_n.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_QaES48F1VIg/TMwmNbXtvXI/AAAAAAAAAi8/ehYPQEznYvE/s1600/14645_204779474340_201821239340_2870631_4663381_n.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;Which of the following statements are true about the relationships between the following classes?&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;a.) A Bar is a Baz&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;b.) A Foo has a Bar&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;c.) A Baz is a Foo&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;d.) A Foo is a Baz&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;e.) A Baz has a Bar&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;Solution :&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;Choices B, C, and E are the correct answers. An instance of the Baz class is also an instance of the class Foo since the Baz class extends the Foo class. So choice C is correct.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="text_exposed_show" style="display: inline;"&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 11px;"&gt;A Baz has a Bar, since instances of the Baz class contain an instance of the Bar class by reference. So choice E is correct.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 11px;"&gt;A Foo has a Baz, since instances of the Foo class contain an instance of the Baz class by reference. Since a Foo has a Baz, which in turn has a Bar, a Foo has a Bar. So choice B is also correct.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 11px;"&gt;Choice A is incorrect because Bar does not extend Baz. Choice D is also incorrect because Foo does not extend Baz either. Refer&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://cnx.rice.edu/content/m11709/latest/" rel="nofollow" style="color: #3b5998; cursor: pointer; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; text-decoration: none;" target="_blank"&gt;http://cnx.rice.edu/conten&lt;wbr&gt;&lt;/wbr&gt;&lt;span class="word_break" style="display: block; float: left; margin-left: -10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;/span&gt;t/m11709/latest/&lt;/a&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 11px;"&gt;&amp;nbsp;for more details.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Source : &lt;a href=http://www.facebook.com/scjp.exam&gt;"Facebook community"&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/499460786565996554-3053114154531349712?l=java.chankeypathak.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/i8v323wuMVMIJrbA4RF61_NJGTU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/i8v323wuMVMIJrbA4RF61_NJGTU/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/i8v323wuMVMIJrbA4RF61_NJGTU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/i8v323wuMVMIJrbA4RF61_NJGTU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://java.chankeypathak.com/feeds/3053114154531349712/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://java.chankeypathak.com/2010/10/quiz-of-day-oct-30-2010.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/3053114154531349712?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/3053114154531349712?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaIsTheFuture/~3/2tw0khP50EU/quiz-of-day-oct-30-2010.html" title="Quiz of the Day | Oct 30, 2010" /><author><name>Chankey Pathak</name><uri>http://www.blogger.com/profile/04990026893506195372</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://1.bp.blogspot.com/_QaES48F1VIg/TRBKsmJYKTI/AAAAAAAAAkg/Evavac_bHNc/S220/100_5098.JPG" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_QaES48F1VIg/TMwmNbXtvXI/AAAAAAAAAi8/ehYPQEznYvE/s72-c/14645_204779474340_201821239340_2870631_4663381_n.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://java.chankeypathak.com/2010/10/quiz-of-day-oct-30-2010.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkICQ3o4eip7ImA9Wx9TE0U.&quot;"><id>tag:blogger.com,1999:blog-499460786565996554.post-3883479567614208729</id><published>2010-10-29T18:11:00.006+05:30</published><updated>2010-11-22T06:46:02.432+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-22T06:46:02.432+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Questions/Answers" /><category scheme="http://www.blogger.com/atom/ns#" term="Puzzle" /><category scheme="http://www.blogger.com/atom/ns#" term="Quiz of the day" /><title>Quiz of the Day | Oct 29, 2010</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;Which of the following statements are true?&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 11px; line-height: 15px;"&gt;a. As soon as the reference count for an object reaches zero, it will be immediately garbage collected.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 11px; line-height: 15px;"&gt;b. The finalize() method will not be invoked more than once by the JVM on the same object.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 11px; line-height: 15px;"&gt;c. The finalize() method cannot be overloaded.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 11px; line-height: 15px;"&gt;d. The garbage collection implementation is JVM-dependent.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 11px; line-height: 15px;"&gt;e. If the finalize() method is overridden, a call to the super class's finalize() method is inserted automatically by the compiler.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 11px; line-height: 15px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 11px; line-height: 15px;"&gt;&lt;iframe align="left" frameborder="0" marginheight="0" marginwidth="0" scrolling="no" src="http://rcm.amazon.com/e/cm?t=s03a71-20&amp;amp;o=1&amp;amp;p=8&amp;amp;l=bpl&amp;amp;asins=0596009208&amp;amp;fc1=000000&amp;amp;IS2=1&amp;amp;lt1=_blank&amp;amp;m=amazon&amp;amp;lc1=0000FF&amp;amp;bc1=000000&amp;amp;bg1=FFFFFF&amp;amp;f=ifr" style="align: left; height: 245px; padding-right: 10px; padding-top: 5px; width: 131px;"&gt;&lt;/iframe&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 15px;"&gt;Solution :&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;Choices B and D are the correct answers.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;As specified by the Java API documentation, the finalize() method is never invoked more than once by a Java virtual machine for any given object. Also, the garbage collection indeed is implementation-&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 11px;"&gt;&lt;span class="text_exposed_show" style="display: inline;"&gt;dependent. This is what the Java Virtual Machine Specification (JVMS) has to say about memory management -&lt;br /&gt;
&lt;br /&gt;
"The heap is created on virtual machine start-up. Heap storage for objects is reclaimed by an automatic storage management system (known as a garbage collector); objects are never explicitly deallocated. The Java virtual machine assumes no particular type of automatic storage management system, and the storage management technique may be chosen according to the implementor's system requirements."&lt;br /&gt;
&lt;br /&gt;
Choice A is incorrect because when the reference count for an object reaches zero, it becomes eligible for garbage collection but that *does not* necessarily mean that it will be immediately garbage collected.&lt;br /&gt;
&lt;br /&gt;
It is perfectly legal to overload the finalize() method like any other method. However, the JVM will always invoke the default, no arguments finalize() method. Hence choice C is incorrect.&lt;br /&gt;
&lt;br /&gt;
Choice E is incorrect because if you override the finalize() method, you must explicitly call the superclass' finalize() method. The compiler *does not* automatically insert this call. Want to know more?&lt;br /&gt;
&lt;br /&gt;
You can read more about garbage collection at -&lt;a href="http://java.sun.com/docs/books/performance/1st_edition/html/JPAppGC.fm.html" rel="nofollow" style="color: #3b5998; cursor: pointer; text-decoration: none;" target="_blank"&gt;http://java.sun.com/docs/b&lt;wbr&gt;&lt;/wbr&gt;&lt;span class="word_break" style="display: block; float: left; margin-left: -10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;/span&gt;ooks/performance/1st_editi&lt;wbr&gt;&lt;/wbr&gt;&lt;span class="word_break" style="display: block; float: left; margin-left: -10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;/span&gt;on/html/JPAppGC.fm.html&lt;/a&gt;&lt;br /&gt;
Also, the API documentation of the Object class contains the necessary information about the finalize() method -&lt;br /&gt;
&lt;a href="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" rel="nofollow" style="color: #3b5998; cursor: pointer; text-decoration: none;" target="_blank"&gt;http://java.sun.com/j2se/1&lt;wbr&gt;&lt;/wbr&gt;&lt;span class="word_break" style="display: block; float: left; margin-left: -10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;/span&gt;.4/docs/api/java/lang/Obje&lt;wbr&gt;&lt;/wbr&gt;&lt;span class="word_break" style="display: block; float: left; margin-left: -10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;/span&gt;ct.html&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Source : &lt;a href=http://www.facebook.com/scjp.exam&gt;"Facebook community"&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/499460786565996554-3883479567614208729?l=java.chankeypathak.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/GADxYjOXWKKSTcv1d2otXuBpXv4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/GADxYjOXWKKSTcv1d2otXuBpXv4/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/GADxYjOXWKKSTcv1d2otXuBpXv4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/GADxYjOXWKKSTcv1d2otXuBpXv4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://java.chankeypathak.com/feeds/3883479567614208729/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://java.chankeypathak.com/2010/10/quiz-of-day-scjp-6-oct-29-2010.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/3883479567614208729?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/499460786565996554/posts/default/3883479567614208729?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/JavaIsTheFuture/~3/n1OTAGcZEy4/quiz-of-day-scjp-6-oct-29-2010.html" title="Quiz of the Day | Oct 29, 2010" /><author><name>Chankey Pathak</name><uri>http://www.blogger.com/profile/04990026893506195372</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://1.bp.blogspot.com/_QaES48F1VIg/TRBKsmJYKTI/AAAAAAAAAkg/Evavac_bHNc/S220/100_5098.JPG" /></author><thr:total>0</thr:total><feedburner:origLink>http://java.chankeypathak.com/2010/10/quiz-of-day-scjp-6-oct-29-2010.html</feedburner:origLink></entry></feed>

