Know the core libraries
Java differs from most other languages in that the number of classes and
interfaces in its standard libraries is very large. Many common tasks have
already been implemented by these libraries.
Advice to beginners might include:
- don't be too intimidated by the large number of classes.
Some are used often, but most are used relatively rarely.
- the most widely used packages are
java.lang
and
java.util
.
- for working with data, see
java.sql
,
javax.sql
,
java.io
,
and
java.nio.file
.
- for graphical applications, see the Swing classes
(javax.swing, and so on).
- for server applications, see the
servlet and
Java Server Page APIs.
- for other packages, you should skim through their documentation just to get an
idea of what is available. Later, when a specific need arises, you will often know
which packages might be helpful.
As well, the standard JDK libraries:
- are generally of high quality
-
often improve their performance over time
-
are widely used, and usually form defacto standards
Implementing something which already exists in the libraries is probably
wasted effort.
Significant changes and additions to the standard libraries occur in
each major release, and it pays to keep current.
The Java 8 release includes:
- java.time
- interfaces with static helper methods, and default methods
- functional interfaces (interfaces with a single method)
- lambda expressions
- method references
- for collections: streams, pipelines and aggregate operations
The Java 7 release includes:
- type inference
- try-with-resources
- java.nio.file - new ways to interact with the file system
- multi-catch - catching multiple exceptions at once
- JavaFX
- binary literals
The Java 6 release includes:
- scripting
- the JConsole monitoring tool
- various Swing improvements
The Java 5 release includes:
- generics
- an enhanced for loop
- enums
- autoboxing
- and annotations
The Java 1.4 release includes:
- regular expressions
- assertions
- logging services
See Also :