CoolInterview.com - World's Largest Collection of Interview Questions & Answers, FAQs, queries, sample papers, exam papers, dumps, what, why, how, where, when questions
Our Services
Get 9,000 Interview Questions & Answers in an eBook.




Get it now !!
Send your Resume to 6000 Companies

Search Interview Questions

Question: What is package? Define with example?

Answer: A package is a grouping of related types providing access protection and name space management. Note that types refers to classes, interfaces, enumerations, and annotation types. Enumerations and annotation types are special kinds of classes and interfaces, respectively, so types are often referred to in this lesson simply as classes and interfaces.



Category Java Interview Questions & Answers - Exam Mode / Learning Mode
Rating (3.7) By 83 users
Added on 5/27/2013
Views 1947
Rate it!
Question: What is package? Define with example?
Answer:

A package is a grouping of related types providing access protection and name space management. Note that types refers to classes, interfaces, enumerations, and annotation types. Enumerations and annotation types are special kinds of classes and interfaces, respectively, so types are often referred to in this lesson simply as classes and interfaces. Source: CoolInterview.com

Answered by: manoj | Date: 6/2/2008 | Contact manoj Contact manoj

Package is a directory of related classes and interfaces.

Eg: java.lang.*

Here java is a directory,lang stands for language & it is a sub directory, * indicates collection of related classes & interfaces Source: CoolInterview.com

Answered by: P.Naren Kumar Reddy | Date: 6/24/2008 | Contact P.Naren Kumar Reddy Contact P.Naren Kumar Reddy

Packages are Java?s way of grouping a variety of classes / interfaces together.
The classes contained in the packages of other programs can be easily reused.
In packages, classes can be unique compared with classes in other packages. Thus, two classes in two different packages can have the same name.
Packages provide a way to hide classes thus preventing other programs or packages from accessing classes that are meant for internal use only.
for example - java.lang
java.util Source: CoolInterview.com

Answered by: Anu Sharma | Date: 8/9/2008 | Contact Anu Sharma Contact Anu Sharma

Package is a collection of .class files and java files
2)all the files in the package must be public.
3)the file must contain the keyword as "package".
4)a package can contain subpackege
5)we can use the classes in package by using import keyword.
Source: CoolInterview.com

Answered by: Manish Sahni | Date: 11/8/2009 | Contact Manish Sahni Contact Manish Sahni

Packages are group of inter-related classes.eg-In math class we can do addition ,subtractionetc.
example of classes are:java.applet
which is used for implementing and creating applets. Source: CoolInterview.com

Answered by: uma shankar pandey | Date: 11/24/2009 | Contact uma shankar pandey Contact uma shankar pandey

packages contain combination of methods and classes.there are many packages available ex:util,io,net,awt etc Source: CoolInterview.com

Answered by: Dinesh | Date: 1/12/2010 | Contact Dinesh Contact Dinesh

package is a collection of classes and interfaces. Source: CoolInterview.com

Answered by: mohan | Date: 2/12/2010 | Contact mohan Contact mohan

Package is a collection of classes,methods,interfaces.packages contain sub packages also.In java awt,util,swing,io,net packages are available. Source: CoolInterview.com

Answered by: ushasri | Date: 4/1/2010 | Contact ushasri Contact ushasri

Package is a collection of class files & Java Files. It also has Sub Packages. Package should have the Keyword Package. Source: CoolInterview.com

Answered by: Divya | Date: 5/14/2010 | Contact Divya Contact Divya

Package is way in which we can grouping one or more classes Source: CoolInterview.com

Answered by: Gajanan Choudhary | Date: 7/10/2010 | Contact Gajanan Choudhary Contact Gajanan Choudhary

Package in java it contains collection of class & interface..
For example :
java.io.*;
java.lang.*;
java.awt.*; Source: CoolInterview.com

Answered by: YUVARAJ.M | Date: 7/19/2010 | Contact YUVARAJ.M Contact YUVARAJ.M

package is a logical container that contain logically related classes interface and sub packages.
Package are use to provide unique name space to classes. Source: CoolInterview.com

Answered by: mukesh singh | Date: 7/27/2010 | Contact mukesh singh Contact mukesh singh

PACKAGE IS A COLLECTION OF INTERRELATED CLASSES AND INTERFACES. Source: CoolInterview.com

Answered by: leo anto | Date: 8/7/2010 | Contact leo anto Contact leo anto


If you have the better answer, then send it to us. We will display your answer after the approval

Rules to Post Answers in CoolInterview.com:-

  • There should not be any Spelling Mistakes.
  • There should not be any Gramatical Errors.
  • Answers must not contain any bad words.
  • Answers should not be the repeat of same answer, already approved.
  • Answer should be complete in itself.

Post your answer here

Inform me about updated answers to this question.
Related Questions
View Answer
If my java based application is hanging once in a while. Where would you start looking at the problem, what changes can you do?

My application has a builtin Ldap client and is communicating with a Ldap server. now having a problem with the authentication, how should i start troubleshooting? I, being responsible for the application and the OS, what can i do?
View Answer
How to invoke the primitive types within object in arraylist?
View Answer
String class can be extendable? and why?
View Answer
What is the difference between attribute and parameter ?
View Answer
What is the difference between length and length() ?
View Answer
What is the difference between concat and append?
View Answer
What is the difference between Java and J2EE? Is J2EE advanced version of Java?
View Answer
How do u create objects at runtime?
View Answer
What is a string Handling? How to use it? what is difference b/w Event handling?
View Answer
What is multi threading ?
View Answer
What are the main differences between
jdk1.4 n jdk1.5?
View Answer
Given A = 1, B = 2, C = 3, D = 4 ?? Z = 26, write a java standalone
program to encode the word ?TELEPHONE? into numbers.
View Answer
Write a java standalone program / method to take out all the special
characters in the string provided below.
//ASCII a ? z (97 ? 122)
String sSENTENCE = ?This!is^a$t*e)s|t?;
View Answer
Why pointers are not used in java?
View Answer
What is super class of an Exception class?
View Answer
What is super class of an Exception class?
View Answer
Why JAVA not support multiple inheritance? How can we pass address of an object?
View Answer
In How many ways we can request the System for the garbage collection to cleanup the memory? And what are the differences?
View Answer
Why java is not pure object oriented language?
View Answer
what is the definition of arraylist? plz write in brief.
View Answer

Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.

View All Java Interview Questions & Answers - Exam Mode / Learning Mode




India News Network
Latest 20 Questions
Payment of time- barred debt is: (a) Valid (b) Void (c) Illegal (d) Voidable
Consideration is defined in the Indian Contract Act,1872 in: (a) Section 2(f) (b) Section 2(e) (c) Section 2(g) (d) Section 2(d)
Which of the following is not an exception to the rule, "No consideration, No contract": (a) Natural love and affection (b) Compensation for involuntary services (c) Completed gift (d) Agency
Consideration must move at the desire of: (a) The promisor (b) The promisee (c) The promisor or any other party (d) Both the promisor and the promisee
An offer which is open for acceptance over a period of time is: (a) Cross Offer (b) Counter Offer (c) Standing Offer (d) Implied Offer
Specific offer can be communicated to__________ (a) All the parties of contract (b) General public in universe (c) Specific person (d) None of the above
_________ amounts to rejection of the original offer. (a) Cross offer (b) Special offer (c) Standing offer (d) Counter offer
A advertises to sell his old car by advertising in a newspaper. This offer is caleed: (a) General Offer (b) Special Offer (c) Continuing Offer (d) None of the above
In case a counter offer is made, the original offer stands: (a) Rejected (b) Accepted automatically (c) Accepted subject to certain modifications and variations (d) None of the above
In case of unenforceable contract having some technical defect, parties (a) Can sue upon it (b) Cannot sue upon it (c) Should consider it to be illegal (d) None of the above
If entire specified goods is perished before entering into contract of sale, the contract is (a) Valid (b) Void (c) Voidable (d) Cancelled
______________ contracts are also caled contracts with executed consideration. (a) Unilateral (b) Completed (c) Bilateral (d) Executory
A offers B to supply books @ Rs 100 each but B accepts the same with condition of 10% discount. This is a case of (a) Counter Offer (b) Cross Offer (c) Specific Offer (d) General Offer
_____________ is a game of chance. (a) Conditional Contract (b) Contingent Contract (c) Wagering Contract (d) Quasi Contract
There is no binding contract in case of _______ as one's offer cannot be constructed as acceptance (a) Cross Offer (b) Standing Offer (c) Counter Offer (d) Special Offer
An offer is made with an intention to have negotiation from other party. This type of offer is: (a) Invitation to offer (b) Valid offer (c) Voidable (d) None of the above
When an offer is made to the world at large, it is ____________ offer. (a) Counter (b) Special (c) General (d) None of the above
Implied contract even if not in writing or express words is perfectly _______________ if all the conditions are satisfied:- (a) Void (b) Voidable (c) Valid (d) Illegal
A specific offer can be accepted by ___________. (a) Any person (b) Any friend to offeror (c) The person to whom it is made (d) Any friend of offeree
An agreement toput a fire on a person's car is a ______: (a) Legal (b) Voidable (c) Valid (d) Illegal
Cache = 0.03125 Seconds