1

I want to be able to use import or at least overcome the compilation problem in some way I am currently having given that I have a 2 files in the default package (hmk requirement) and one has a class the other has a class as well as a main. Right now the file with the main seems unaware of the other file at least as far as eclipse is concerned. import [otherfilenameWithout.java] doesn't seem to work.

I did see this but it seem like these answers are in regard to accessing from a non-default package to the default package. I could be wrong though.

How to access java-classes in the default-package?

Community
  • 1
  • 1
Bren
  • 3,516
  • 11
  • 41
  • 73

2 Answers2

3

By default, the classes in the same package are already imported. You don't need to declare any import for this. So to access to the default package classes can only be done by classes in the default package.

Ricard Nàcher Roig
  • 1,271
  • 12
  • 14
  • using a new before creating a new object on the other hand is needed.... my bad. Thanks! – Bren Feb 27 '16 at 22:44
0

Be sure you include . in your classpath when compiling

Xavisan
  • 53
  • 1
  • 6