Cannot import custom made java class

Hello

I wrote a java class say (Money.java) which compiled fine. When I was importing it to another class (Account.java), the folowing error message appears:

Account.java.1:'.' expected

import Money;(an errow pointing to ";")

I dont think the code is wrong, because when I cut and attach the Money class code to the front of the Account class it compiled successfully.... I am confused! I wrote the import command according to the text book as follows:

import Money;

public class Account

{............}

By the way, both the Money and Account classes are saved in the save folder... How come it wont let me import...

Looking forward for an early reply.

Thanks

[727 byte] By [haipeng.wanga] at [2007-10-3 2:59:45]
# 1
Put money in a package and import the packageThe import is used to include classes in a package
r035198xa at 2007-7-14 20:49:22 > top of Java-index,Java Essentials,Java Programming...
# 2

> I wrote the import command according to the text book as follows:

> import Money;

According to which textbook? If it suggests that, it's wrong.

If you don't use packages, you don't need to import your classes.

If you use packages, you need to always use packages throughout your program.

You can't mix.

CeciNEstPasUnProgrammeura at 2007-7-14 20:49:22 > top of Java-index,Java Essentials,Java Programming...
# 3

In older versions of Java, it was possible to import classes from the default package using a statement like:

import Money;

This feature has been removed from Java as of version 1.5. You cannot import classes from the default package.

Note that if your other code (Account.java) is also in the default package, you do not need to import the class Money. Just remove the import statement.

If class Account is in a different package and you want to use class Money, then the only option you have is to put class Money in another package than the default (unnamed) package.

jesperdja at 2007-7-14 20:49:22 > top of Java-index,Java Essentials,Java Programming...
# 4
From the names of the classes only I would suggest having them both in the same package
r035198xa at 2007-7-14 20:49:22 > top of Java-index,Java Essentials,Java Programming...