i have make one package(c:\program files\java\jdk1.6.0\bin\MyPack)
and save file as AccountBalance.java this file has two classes.see below.
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.print(name+":$"+bal);
}
}
class AccountBalance
{
public static void main(String args[])
{
Balance current[]=new Balance[3];
current[0]=new Balance("ajay",123.23);
current[1]=new Balance("rinku",145.25);
current[2]=new Balance("don",-152.12);
for(int i=0;i<3;i++)
current.show();
}
}
now i m import this package in file Hello.java(c:\my java\Hello.java)
as given below.
import MyPack.AccountBalance;
class Hello extends AccountBallance
{
public static void main(String arg[])
{ System.out.print("my name is ajay jaiswal");
AccountBalance b=new AccountBalance();
}
}
on compling this i m gating error
packge MyPack does not exist
can u tellme where i m wrong.
i have also try to import
import MyPack.*;
but it is also not working
i try this also
import MyPack.Balance;
import MyPack.AccountBalance;
but result is same error