➢ Define a package named myInstitute include class named as department with
one method to display the staff of that department. Develop a program to import
this package in a java application and call the method defined in the package.
package myInstitute;
public class department
public void display()
System.out.print("Name of Staff is \n 1. Rajesh \n 2. Ram \n 3. Ramesha \n 4.
Rahul ");
import myInstitute.*;
class mydep
public static void main(String args[])
department d=new department();
d.display();
}
➢ Develop a program which consist of the package named let_me_calculate with a
class named calculator and a method named add to add two integer number.
Import let_me_calculate package in another program (class named Demo) to add
two numbers.
package let_me_calculate;
public class calculator
int x,y,z;
public void add(int a,int b)
x=a;
y=b;
z=x+y;
System.out.print("Addition of "+x+" and "+y+" : "+z);
import let_me_calculate.*;
class demo
public static void main(String args[])
calculator c=new calculator();
c.add(10,20);