<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SCJP Certification &#187; object</title>
	<atom:link href="http://www.scjp-certification.com/tag/object/feed" rel="self" type="application/rss+xml" />
	<link>http://www.scjp-certification.com</link>
	<description>Sun Certified Java Programmer Certification exam essentials</description>
	<lastBuildDate>Fri, 30 Sep 2011 05:54:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>What is the ClassCastException?</title>
		<link>http://www.scjp-certification.com/what-is-the-classcastexception.html</link>
		<comments>http://www.scjp-certification.com/what-is-the-classcastexception.html#comments</comments>
		<pubDate>Tue, 03 Nov 2009 11:15:45 +0000</pubDate>
		<dc:creator>Daisy Williams</dc:creator>
				<category><![CDATA[Java Facts]]></category>
		<category><![CDATA[ClassCastException]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[message]]></category>
		<category><![CDATA[object]]></category>
		<category><![CDATA[RuntimException]]></category>

		<guid isPermaLink="false">http://www.scjp-certification.com/?p=348</guid>
		<description><![CDATA[A ClassCastException is thrown when an attempt is made to cast an object, which is not of the appropriate run-time...]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.scjp-certification.com%2Fwhat-is-the-classcastexception.html"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.scjp-certification.com%2Fwhat-is-the-classcastexception.html&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>A ClassCastException is thrown when an attempt is made to cast an object, which is not of the appropriate run-time type. It extends from the RuntimeException class. It For example:</p>
<p><strong>Object obj = new Vector();<br />
String s = (String) obj;</strong></p>
<p>Following are the two kinds of constructors for ClassCastException: </p>
<p><strong>ClassCastException()</strong></p>
<p>It will construct a ClassCastException without any detailed message. </p>
<p><strong>ClassCastException(String str) </strong></p>
<p>It will construct a ClassCastException with the specified detailed message.  </p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.scjp-certification.com%2Fwhat-is-the-classcastexception.html&amp;title=What%20is%20the%20ClassCastException%3F"><img src="http://www.scjp-certification.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.scjp-certification.com/what-is-the-classcastexception.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What is a constructor?</title>
		<link>http://www.scjp-certification.com/what-is-a-constructor-2.html</link>
		<comments>http://www.scjp-certification.com/what-is-a-constructor-2.html#comments</comments>
		<pubDate>Mon, 02 Nov 2009 12:04:35 +0000</pubDate>
		<dc:creator>Daisy Williams</dc:creator>
				<category><![CDATA[Java Facts]]></category>
		<category><![CDATA[constructor]]></category>
		<category><![CDATA[default]]></category>
		<category><![CDATA[final]]></category>
		<category><![CDATA[initialize]]></category>
		<category><![CDATA[object]]></category>

		<guid isPermaLink="false">http://www.scjp-certification.com/?p=343</guid>
		<description><![CDATA[A constructor provides a convenient way to initialize a newly created object at the time of its creation. A constructor...]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.scjp-certification.com%2Fwhat-is-a-constructor-2.html"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.scjp-certification.com%2Fwhat-is-a-constructor-2.html&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>A constructor provides a convenient way to initialize a newly created object at the time of its creation. A constructor is automatically called emmediately after the creation of a new object, but before the new operator completes. All Java classes must have at least one constructor, either explicitly declared in the class or an implicit default constructor. They are typically used to create an object that is an instance of a class. It is written by using the following general syntax:</p>
<p><strong>[access modifier] class name([formal parameter list]) [throws clause] {<br />
   // Body of the constructor<br />
}</strong></p>
<p>where, the elements within square brackets are optional. </p>
<p>The following rules are followed before writing a constructor for a class:
<ol>
<li>It uses the name of the class in which it is defined.</li>
<li>A constructor is always written without an explicit return type, not even void. This is because the implicit return type of a class constructor is the class itself.</li>
<li>Only accessibility modifiers can be used to declared a constructor. Unlike methods, a constructor cannot be declared as abstract, static, final, native, strictfp, or synchronized.</li>
</ol>
<p>The following is an example of a constructor:</p>
<p><strong>class Book{<br />
   String name;<br />
   String author;<br />
    Rectangle(String str1, String str2){<br />
       // more code<br />
   }<br />
}</strong>  </p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.scjp-certification.com%2Fwhat-is-a-constructor-2.html&amp;title=What%20is%20a%20constructor%3F"><img src="http://www.scjp-certification.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.scjp-certification.com/what-is-a-constructor-2.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

