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
Significant changes and additions to the standard libraries occur in each major release, and it pays to keep current.
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
- scripting
- the JConsole monitoring tool
- various Swing improvements
- generics
- an enhanced for loop
- enums
- autoboxing
- and annotations
The Java 1.4 release includes:
- regular expressions
- assertions
- logging services
See Also :
Would you use this technique?