I use import TableTest1 in my TableDemo.java file. But I got compiling
error as below.
TableDemo.java:5: '.' expected
import TableTest1;
^
Please help.
Laurent D.A.M. MENTEN - 20 Sep 2007 20:45 GMT
moongeegee a écrit :
> I use import TableTest1 in my TableDemo.java file. But I got compiling
> error as below.
[quoted text clipped - 4 lines]
>
> Please help.
If TableTest1 is a class, either it is in the same package so you don't
need to import it, or it is in another package then you have to prefix
it with its package specification.
Roedy Green - 21 Sep 2007 03:29 GMT
>I use import TableTest1 in my TableDemo.java file. But I got compiling
>error as below.
>
>TableDemo.java:5: '.' expected
>import TableTest1;
you need to post more code to make the error clear. See
http://mindprod.com/jgloss/import.html
http://mindprod.com/jgloss/package.html

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Roedy Green - 21 Sep 2007 03:41 GMT
>TableDemo.java:5: '.' expected
>import TableTest1;
> ^
package names are usually all lower case.
You don't import classes that don't live in packages.
If you have more than one class, they all should live in explicit
packages.

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Thomas A. Russ - 21 Sep 2007 19:11 GMT
> I use import TableTest1 in my TableDemo.java file. But I got compiling
> error as below.
>
> TableDemo.java:5: '.' expected
> import TableTest1;
> ^
Import is only needed for classes defined in other Java Packages. It
deals with package visibility in your file. Eliminate the import statement.

Signature
Thomas A. Russ, USC/Information Sciences Institute
Lew - 21 Sep 2007 20:11 GMT
>> I use import TableTest1 in my TableDemo.java file. But I got compiling
>> error as below.
[quoted text clipped - 5 lines]
> Import is only needed for classes defined in other Java Packages [sic]. It
> deals with package visibility in your file. Eliminate the import statement.
The source of the compiler error was
<http://java.sun.com/docs/books/jls/third_edition/html/packages.html#7.5>
> It is a compile time error to import a type from the unnamed package.
Arguably the error message should say so in just those words, instead of "'.'
expected".

Signature
Lew
Roedy Green - 22 Sep 2007 00:26 GMT
>TableDemo.java:5: '.' expected
>import TableTest1;
see http://mindprod.com/jgloss/compileerrormessages.html#DOTEXPECTED

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com