You may want to browse around this web page, particularly its "Reference" tab -which leads you to the API documentation- and the "Downloads" tab, from where you can get the latest Java version (which is Java 6).
Information and documentation regarding older Java releases (such as Java 5 a.k.a. 1.5) can be found here.
Is it possible to write a java program to listout all the interfaces and classes?
I do not think any JDK provide such method , but you can try File class which reads javadocs directory , which list all the files which included into Jdk doc directory , I am providing a jdk 5 doc directory structure , a which find you all the classes and interfaces !! " F:\jdk-6-doc\docs\api\java " , this is definitely not a optimum solution , but as you need it , this ll help !!
The JRE comes with all classes bundled in a jar file (it's called classes.jar in my installation). You can open that using the classes in the java.util.jar package and iterate recursively through all the files it contains.
With the bytes you read from the file you can then let a ClassLoader construct Class objects for all classes/interfaces. That allows you to get a wealth of information about each class.
That's definitely not beginner's stuff, though. What are you trying to achieve by knowing which classes exist?