Which of the following statements declare class Sample to belong to the payroll.admindept package?

Options
- package payroll; package admindept;
- import payroll.*;
- package payroll.admindept.Sample;
- import payroll.admindept.*;
- package payroll.admindept;


CORRECT ANSWER : package payroll.admindept;

Discussion Board
thanks

this great help.
thanks

nagy 03-26-2017 04:38 PM

basics of java

good stuff!!!

sudeep kumar das 09-6-2014 11:31 AM

Packages

Packages are combining entities of many methods and classes. It has the following use:
1. Prevents naming conflicts
2. Provide the control access
3. Provide searching/locating of classes
4. Provide the corret usage of classes, interfaces, enumerations, etc.

It is a group of related types (classes, interfaces, enumerations and annotations ) which provides access protection and name space management.

The package is defined as:

package payroll;

public class admindept
{
public void payEmployee(Employee e)
{
e.mailCheck();
}
}

It is then again can be used in some other class by:

payroll.admindept

Rohit Sharma 07-27-2014 11:26 PM

Write your comments


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement