Posted By:
P_T
Posted On:
Tuesday, June 19, 2001 10:57 AM
I am getting a error message, when I try to run the following program, though it seems to compile fine. 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 + ": $" + bal); } } class AccountBalance { public static void main(String args[]) { Balance current[] = new Balance[3];
More>>
I am getting a error message, when I try to run the following program, though it seems to compile fine.
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 + ": $" + bal);
}
}
class AccountBalance {
public static void main(String args[]) {
Balance current[] = new Balance[3];
current[0] = new Balance("K.J.Fielding", 123.23);
current[1] = new Balance("Will Tell", 157.02);
current[2] = new Balance("Tom Jackson", -12.33);
for(int i=0; i
<3; i++) current[i].show();
}
}
My working directory is C:jdk1.3.1libclasses. I have created a subdirectory called MyPack under classes.
The error message is as follows :-
Exception in thread "main" java.lang.NoClassDefFoundError: MyPack/AccountBalance
Please advise. Regards,
<<Less