<?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>Java Interview Questions &#187; Java Package</title>
	<atom:link href="http://www.bestjavainterviewquestions.com/category/java-package/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bestjavainterviewquestions.com</link>
	<description>Java Interview Questions &#124; Core Java Interview Questions &#124; Advanced Java Interview Questions &#124; EJB Interview Questions &#124; J2EE Interview Questions &#124; Hibernate Interview Questions</description>
	<lastBuildDate>Fri, 03 Feb 2012 10:23:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Java Package</title>
		<link>http://www.bestjavainterviewquestions.com/java-package/</link>
		<comments>http://www.bestjavainterviewquestions.com/java-package/#comments</comments>
		<pubDate>Tue, 23 Sep 2008 16:44:06 +0000</pubDate>
		<dc:creator>Ramakrishna</dc:creator>
				<category><![CDATA[Java Package]]></category>
		<category><![CDATA[java packages]]></category>

		<guid isPermaLink="false">http://www.bestjavainterviewquestions.com/?p=373</guid>
		<description><![CDATA[Package : A package represents a sub directory where we store some Classes and Interfaces Also A package is a sub directory that contains a group of Classes and Interfaces Advantages of Packages : 1) It hides Classes and Interfaces in a subdirectory so that accidental deletion is not possible 2) The Classes of one [...]]]></description>
			<content:encoded><![CDATA[<p><span style="text-decoration: underline;"><strong><font size=3>Package</strong></span> :  A package represents a sub directory where we store some <em>Classes</em> and <em>Interfaces</em></p>
<p>Also A package is a sub directory that contains a group of <em>Classes and Interfaces</em></p>
<p><span style="text-decoration: underline;"><strong><font size=3>Advantages of Packages</strong></span> :</p>
<p>1)   It hides Classes and Interfaces in a subdirectory so that accidental deletion is not possible</p>
<p>2)  The Classes of one Package are isolated from the Classes of another Packages this means we can<br />
 use same name for the classes in 2 different Packages</p>
<p>3)  Packages provide resuability, this make software develop easily. The productivity of a program may increase because of reusability</p>
<p>4)  Once a package is created it can be extended (or) a new package can be created</p>
<p><u>Syntax</u> :<br />
<strong><em>package  package-name;</em></strong></p>
<p>You Must compile the package with the Command <strong>javac -d </strong> (-d indicates the directory)</p>
<p>## <em>Sample Program of Java Package is</em></p>
<p>//Creating a package:pack</p>
<p>package pack;<br />
public class Addition<br />
{<br />
double d1,d2;<br />
public Addition(double d1,double d2)<br />
{<br />
this.d1=d1;<br />
this.d2=d2;<br />
}<br />
public void sum()<br />
{<br />
System.out.println(&#8220;sum=&#8221;+(d1+d2));<br />
}<br />
}</p>
<p>Compile this with the Command</p>
<p><strong>javac -d Addition.java</strong></p>
<p>## Sample 2#</p>
<p>//Using the package-pack</p>
<p>class use<br />
{<br />
public static void main(String args[])<br />
{<br />
pack.Addition obj=new Addition(10,15.5);<br />
obj.sum();<br />
}<br />
}</p>
<h2  class="related_post_title">Random Posts</h2><ul class="related_post"><li>September 22, 2008 -- <a href="http://www.bestjavainterviewquestions.com/difference-between-include-and-import/" title="Difference between #include and Import">Difference between #include and Import</a> (2)</li><li>July 1, 2008 -- <a href="http://www.bestjavainterviewquestions.com/java-thread-questions/" title="Java Thread Questions">Java Thread Questions</a> (1)</li><li>October 3, 2008 -- <a href="http://www.bestjavainterviewquestions.com/explain-jsp-declaration/" title="Explain JSP Declaration">Explain JSP Declaration</a> (0)</li><li>December 16, 2008 -- <a href="http://www.bestjavainterviewquestions.com/define-array-in-java/" title="Define Array in Java">Define Array in Java</a> (1)</li><li>October 27, 2008 -- <a href="http://www.bestjavainterviewquestions.com/benefits-of-connection-pooling/" title="Benefits of Connection Pooling">Benefits of Connection Pooling</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.bestjavainterviewquestions.com/java-package/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

