JavaLanguage Section Index
Project Coin refers to a number of small changes to the Java language that were included in JDK 7.
New in Java 7, JSR 292 allows dynamic languages to run faster in the JVM than in previous JDK versions.
Here are the major language changes in JDK7.
The split() method of String takes a regular expression. The pattern "[s,]+" should to the trick. It says the separator will be one or more white space characters or comma.
How can the following throw a NullPointerException? Integer i = ...; int j = i;
You place the @Deprecated annotation above the method or class you want to flag as out of date. You can still use the @deprecated javadoc tag to say why something is deprecated: public class Dep ...more
I have written plenty of non-thread-safe Singletons but it wasn't until recently when I tracked it down that I realized that thread-safety could be a big problem. The problem is that in the typic...more
A checked exception is any subclass of Exception (or Exception itself), excluding class RuntimeException and its subclasses. Making an exception checked forces client programmers to deal with th...more
Check out logging packages like log4j and unit testing frameworks like JUnit. Check out static analysis tools such as Metamata's Audit and Metrics products. For dyanmic analysis and manipulati...more
In a switch statement, does it matter if I put the default condition at the top or bottom (or anywhere in between)?
You can put the default: labeled clause anywhere you can put any of the switch's cases. In fact, you don't have to specify a default case at all.
For changes between Java v1.0 and v1.1 check out: JDK 1.1.x Compatibility with Previous JDK Releases and JDK v1.1 New Features Summary. For changes between Java v1.1 and v1.2 check out the JDK v1...more
Java provides escape sequences for several non-graphical characters. All characters can be specified as a hexidecimal Unicode character (uxxxx) with some as an octal character (ddd where the first...more
The capability of using the final modifier on formal parameters was introduced in the Java 1.1 update. Basically, it's just like using final on a class field. That is to say that using it tells ...more
Well, there's no direct support for variable-length method argument lists in Java. However, you can simulate this yourself using whatever object container you prefer such as the ubiquitous java.u...more