Understanding Packages and Interfaces in Java
page 3 of 11
by Debjani Mallick
Feedback
Average Rating: 
Views (Total / Last 10 Days): 56264/ 153

Creating a Package

The statement that is used to create a package requires a keyword called “package” and the following syntax.

Listing 1

package packagename;

The package definition must be the first statement of the java program file. Suppose we have a program file named “Firstapplication.java” and we want to put it inside a package called Example, then the coding that would go inside is:

Listing 2

package Example;
public class Firstapplication 
{
      public static void main(String a[ ]) 
      {
            System.out.println("This is my first application");
      }
}

If package statement is not specified, all the classes are stored in a default unnamed package.


View Entire Article

User Comments

Title: air max shoes r Five, please,��   
Name: anciag
Date: 2012-12-05 2:43:16 AM
Comment:
r Five, please,�� said the loud-speaker
Number Five was Roger Clint��s mount with the long white stockings. ��Do you [url=http://www.airmax2013cheap.com/nike-air-max-2011-c-5.html]air max 2011[/url] know what he calls it?�� Bee said. ��Operation Stockings.��
��It��s very ugly,�� Brat said. ��Looks as if he had walked through [url=http://www.airmax2013cheap.com/]nike new air max shoes[/url] air max 2013 a trough of whitewash.��
��He can jump, though.��
He could certainly jump, but he had phobia about water.
��Poor Roger,�� laughed Bee, watching Stockings refuse the water. ��He has been jumping him backwards and forwards across the duck pond at home in the hope of curing him, and now he does this!��
Stockings continued to refuse, and Clint had to take him out, in [url=http://www.airmax2013cheap.com/]new air max shoes[/url] a burst of sympathetic applause.
Numbers Six and Seven had one fault each.
Number Eight was Simon on Timber.
The black horse came into the ring exactly as he had come out of his box on the day Brat first saw him, pleased with himself and ready fo
Title: wholesale cheap ravens jerseys   
Name: ARMANI
Date: 2012-06-03 10:53:21 PM
Comment:
http://jerseymember.com/Baltimore-Ravens-Jerseys-s617.html
Title: 2012 NFL jerseys   
Name: NIKE NFL jerseys
Date: 2012-05-20 11:28:31 PM
Comment:
[/pre]Cheap NFL,NBA,MLB,NHL
[url=http://www.jersey2shop.com/]Jerseys From China[/url]
[url=http://www.jersey2shop.com/]2012 nike nfl Jerseys[/url]
[url=http://www.jersey2shop.com/]cheap China Jerseys[/url]
[url=http://www.jersey2shop.com/]Sports Jerseys China[/url]
[url=http://www.jersey2shop.com/NFL-Jerseys-c68/]NFL Jerseys China[/url]
[url=http://www.jersey2shop.com/NBA-Jerseys-c77/]NBA Jerseys China[/url]
NHL Jerseys China
[url=http://www.jersey2shop.com/MLB-Jerseys-c94/]MLB Jerseys China[/url]NFL jerseys For Sale online.All Our Jerseys Are Sewn On and Directly From Chinese Jerseys Factory
[/pre]
[pre]We Are Professional China jerseys Wholesaler
[url=http://www.cheapjersey2store.com/]Wholesale cheap jerseys[/url]Cheap mlb jerseys
[url= http://www.cheapjersey2store.com/]2012 mlb all atar jerseys[/url]
[url= http://www.cheapjersey2store.com/ [/url]Cheap China Wholesael[/url]
[url= http://www.cheapjersey2store.com/]Wholesale jerseys From China[/url]
[url=http://www.cheapjersey2store.com/]2012 nike nfl Jerseys[/url]Free Shipping,Cheap Price,7 Days Deliver
[/pre]
[/pre]
We are professional jerseys manufacturer from china,wholesal
sports [url= http://www.cheapjersey2store.com/]Jerseys From China[/url]
[url=http://www.cheapjersey2store.com/NFL-Jerseys-c68]NFL jerseys China[/url]
[url=http://www.cheapjersey2store.com/NHL-Jerseys-c96/]NHL Jerseys China[/url]
[url=http://www.cheapjersey2store.com/NBA-Jerseys-c77/]NBA Jerseys China[/url]
[url=http://www.cheapjersey2store.com/MLB-Jerseys-c94/]MLB Jerseys China[/url]
[url= http://www.cheapjersey2store.com/]China Jerseys[/url],Free Shipping
[/pre]
[/pre]
We are professional jerseys manufacturer from china,wholesal
sports [url= http://www.jerseycaptain.com/]cheap jerseys sale online [/url]
[url= http://www.jerseycaptain.com/]2012 nike nfl Jerseys[/url]
[url=http://www.jerseycaptain.com/NFL-Jerseys-c68]cheap NFL jerseys China[/url]
[url=http://www.jerseycaptain.com/NHL-Jerseys-c96/]NHL Jerseys C
Title: Real time example   
Name: Axe
Date: 2012-04-10 10:19:44 PM
Comment:
Any real time example for package which is used in daily life
Title: creating a package   
Name: golnaz
Date: 2012-01-23 4:01:45 AM
Comment:
Thanks a lot, was very useful
Title: Packages and interfaces   
Name: Lesedi
Date: 2011-02-25 5:55:35 AM
Comment:
post more details
Title: packages and interfaces in java   
Name: sinha timir krishna murari
Date: 2010-11-14 6:59:20 AM
Comment:
explanation of the concept in full detail with the definition of the topic
Title: drawback of interface   
Name: neeraj singh
Date: 2010-09-16 4:17:34 PM
Comment:
post in detail moreeeeeeeeeeee
Title: creating package   
Name: Nitesh
Date: 2010-04-20 12:53:18 AM
Comment:
gives alot of confidence to person
Title: thakur   
Name: Nitesh
Date: 2010-04-20 12:49:47 AM
Comment:
give more information
Title: package   
Name: puja
Date: 2010-01-27 11:05:13 AM
Comment:
can give more information about advantages of packages.
Title: Mistake   
Name: Gyandeep
Date: 2009-11-19 5:16:23 AM
Comment:
Ma'am, you have made a slight mistage here. The refernce variable you have used d takes r to its account and prints r.area(). It should be d.area. In the main().

Thanks and cheers!
Title: Interfaces and packages   
Name: Tamkeen
Date: 2009-07-07 2:55:10 AM
Comment:
Very precise and easily understandable language.
Title: package   
Name: Duraipandi
Date: 2008-10-14 7:34:39 AM
Comment:
It is very nice.here syntax and examples are each and every thing fine.
Title: very nice elaboration   
Name: Regalla Naresh Reddy
Date: 2008-06-10 3:36:05 AM
Comment:
Its vey nice.If you include syntax and an exmaple on syntax looks very nice.So try it
Title: doubt   
Name: raghavendra
Date: 2008-03-15 3:01:11 AM
Comment:
i have created a package named account and i created a new folder name test inside test i written a java program to access the package account.. its saying package account not found.. kindly help me.. if any..
Title: very nice   
Name: antony
Date: 2008-01-22 6:14:33 AM
Comment:
its very very useful for beginers.so thanks for you.and also i want more in swing and awt etc
Title: Nice   
Name: Ed
Date: 2007-08-12 10:34:37 PM
Comment:
NICE ARTICLE
Title: Good work   
Name: Rick
Date: 2007-08-10 10:50:14 PM
Comment:
It is a good piece of work.

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-10-16 1:36:48 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search