This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
It does give me the following error messages: Program.java:2: �.� expected import Juoma;
I have been said that "Class1 should be in a package. Since Java 1.4, you have been unable to import a class from the default package." So, how do I create a package? Or how do I use the file class1 in other way?
There is no need to import a class from default package.
Import allows to use simple name (without package) of the imported class instead of fully qualified name (with package). Classes in defulat package have same simple and fully qualified name so importing such class would do nothing.
If class1 is not in a package, and your own class is not in a package (i.e., they are both in the default package), just put both *.class files in the same directory and it will work.
Just remove the "import class1" statement. You don't need to import classes that are in the same package.
Vlado: it is not even possible to import packages in the default package since Java 1.4. So if class1 is in the default package but your own class is not, you wouldn't be able to use class1 at all in your own class. [ January 31, 2006: Message edited by: Jesper de Jong ]
All JavaRanch users are asked to use a real name as their display name, with a first and last name, and maybe more, separated by spaces. Obviously fictitious names may be locked out. By "real name", we mean either your own actual, personal name, or a name that at least looks like it could belong to a real person. No names of celebrities or fictional characters. No cute nicknames like "javarulz" or "Hacker King". No joke names like "Adam Baum" (atom bomb) or "Justin Case" (just in case). No names with embedded numbers or other unorthodox punctuation like "Mike505" or "John_Smith". No names of companies - just people.