// Program to explain Importing Package
package MyPack;
public class Balance
{
String name;
double bal;public Balance(String n, double b)
{
name = n;
bal = b;
}public void show()
{
if(bal<0)
System.out.print("--> ");
System.out.println(name + ": Rs. " + bal);
}
}// Second File as( BalanceImport.java in current folder) :
import MyPack.*;
class BalanceImport
{
public static void main(String args[ ])
{
Balance ob = new Balance("Nils", 234.56);
ob.show();
}
}
Output:Nils: Rs. 234.56