What's the syntax to import a class in a default package in Java?
Posted
by Lord Torgamus
on Stack Overflow
See other posts from Stack Overflow
or by Lord Torgamus
Published on 2010-01-08T19:31:02Z
Indexed on
2010/05/21
21:10 UTC
Read the original article
Hit count: 159
Possible Duplicate: How to access java-classes in the default-package?
Is it possible to import a class in Java which is in the default package? If so, what is the syntax? For example, if you have
package foo.bar;
public class SomeClass {
// ...
in one file, you can write
package baz.fonz;
import foo.bar.SomeClass;
public class AnotherClass {
SomeClass sc = new SomeClass();
// ...
in another file. But what if SomeClass.java does not contain a package declaration? How would you refer to SomeClass
in AnotherClass
?
© Stack Overflow or respective owner