// Program to explain Creating Package.
package MyPack;
class Balance
{
String name;
double bal;
Balance(String n, double b)
{
name = n;
bal = b;
}
void show()
{
if(bal<0)
System.out.print("--> ");
System.out.println(name + ": Rs. " + bal);
}
}class AccountBalance
{
public static void main(String args[ ])
{
Balance current[ ] = new Balance[3];
current[0] = new Balance("Nils", 123.45);
current[1] = new Balance("Poojan", 345.12);
current[2] = new Balance("Darshan", -12.34);
for(int i=0; i<3; i++)
{
current[ i ].show();
}
}
}
Output:Nils: Rs. 123.45
Poojan: Rs. 345.12
--> Darshan: Rs. -12.34