I would put it (like any other class) in the package it belongs most from it's content. That mostly - but not everytime - means, that you put it in the same package as implementing classes. Sometimes you put an abstract class in the same package as some other class using this abstract class - it's part of the API of the other class. Implementing classes could be somewhere else in that case. I never use extra packages for abstract classes or other stuff like exception-classes or so.
Why so? I prefer to use package-structure as building a system for categorizing the content of the software, instead as using it for implementation details. The abstract-class may become later a valid non-abstract-class without breaking the API. But if I have to move it's package it would break again old code. Unnessecary I think.
Per Wikipedia, the first formally released version of Java was 1.0.2, on Jan 23 1996.
The first stable version was the JDK 1.0.2. is called Java 1
There's an archive of Java 1.0.2 and all related documentation here:
- JDK 1.0.2 API reference (book format)
- JDK 1.0.2 API reference (javadoc format)
- Java tutorial
- Java language specification (link broken, wayback'd here)
- Java virtual machine specification
There appears to be a download of the JDK 1.0.2 bits here
http://www.pascal-man.com/download/download-jdk.shtml
It works for me at the time of writing.
BEHOLD THE RAW UNMITIGATED POWER OF JAVA 1.0.2
In the language spec, the following classes are referred to (single citation, not exhaustive citations):
- Class (section 4.3.1)
- String (section 4.3.1)
- Object (section 4.3.2)
- Random (section 4.4)
- Thread (section 17.2)
- ThreadGroup (section 17.2)
- Throwable (section 11)
- Error (section 11.2)
- loads and loads of errors, all under java.lang (section 11.5.2.1 - 11.5.2.2)
- RuntimeException (section 11.2.1)
- the "Array classes",
[I
, and so on (section 10.8)
... at which point I stopped looking because, technically, [I
, et. al. aren't in the java.lang
, java.util
, or java.io
packages.
Example:
class Test {
// Compare namespaces of built-ins object and int[]
public static void main(String[] args){
int[] arr = new int[0];
Object obj = new Object();
Class arrClass = arr.getClass();
Class objClass = obj.getClass();
Class arrSuper = arrClass.getSuperclass();
System.out.println("plain jane Object - " + objClass.getName());
System.out.println();
System.out.println("int[] - "+arrClass.getName());
System.out.println("super of int[] - "+arrSuper.getName());
}
}
Outputs
Behavior is consistent between modern and 1.0.2
Best Answer
As explained in its javadoc, the purpose of
Iterable
is to support particular language syntax:As such, it belongs to the lang package, which
Other classes at the diagram belong to JCF and hence, are in the util package which