aspose file tools*
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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "importing my own class " Watch "importing my own class " New topic
Author

importing my own class

Auliver Brogan
Greenhorn

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 MyClass.java to get MyClass.class.
In Applet19.java, 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 .

TIA
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41509
    
  53
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).


Ping & DNS - my free Android networking tools app
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
you can fin info there :
http://java.sun.com/docs/books/jls/second_edition/html/packages.doc.html
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: http://aspose.com/file-tools
 
subject: importing my own class