File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes importing my own class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "importing my own class " Watch "importing my own class " New topic

importing my own class

Auliver Brogan

Joined: May 15, 2006
Posts: 1
I'm just starting to re-learn java. I've been going over some old notes I have and creating some basic applets.
The point I've gotten to so far is writing a class, then importing into another java file.
I've written and compiled to get MyClass.class.
In, I have the following line,

that's what it says in my notes.

When I compile it, the error message is,

So I put in a dot, '.', recompiled and this time the error message was,

So I put in an asterisk, '*', and this time the error message was,

I can't think of anything else to do.
What error am I making? What is the correct syntax (?) for importing your own defined class into another java file .

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Welcome to JavaRanch.

"import" is for specifying classes that are in partiuclar packages. If neither class has a package statement, then the import is unnecessary (and not understood by the compiler, as you have you seen).
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
you can fin info there :
Sunil Kumar Gupta
Ranch Hand

Joined: Aug 26, 2005
Posts: 824
I think you should take the help of books to start again with java. Becuase the kind of questions you are asking and wasting your time to solve them just by guessing.

This is not the right way to learn any language. Just go through any java book atleast once.

Lack of will power has caused more failure than lack of intelligence or ability.
My Blog | Red5 Resources | Technology Update | Daily Technology Tips
I agree. Here's the link:
subject: importing my own class
jQuery in Action, 3rd edition