Extending java util classes by the book

I am writing a new set of classes to support 2 Key access to maps. Looking at the java.util sources I see that the files there are with ".class" extension, not ".java" and for some reason Eclipse recognizes other classes used in java.util, without any need to declare them in import, whether my own class needs the import otherwise Eclipse marks it as error.

Is there a "book" for doing these kind of things, or guidelines?

Do I need to rename my .java to .class?

Is it OK to import inside my util classes and interfaces, or is there a flag to signal eclipse that this like java.util classes?

Jon Skeet
people
quotationmark

Looking at the java.util sources I see that the files there are with ".class" extension, not ".java"

That just means you're looking at the source file attached to the classes rather than a source file in your project. The source itself is still in .java files, embedded within the source attachment zip file.

and for some reason Eclipse recognizes other classes used in java.util, without any need to declare them in import

When you're writing code for a class declared in package x.y.z, that package is implicitly imported. So if you're looking at code for classes in java.util, they don't need to import other classes within java.util. They'd need to import classes in other packages such as java.io though.

people

See more on this question at Stackoverflow