JavaLanguage Section Index
What is Project Coin (JSR 334)?
Project Coin refers to a number of small changes to the Java language that were included in JDK 7.
What is InvokeDynamic (JSR 292)?
New in Java 7, JSR 292 allows dynamic languages to run faster in the JVM than in previous JDK versions.
What are the new features in Java 7?
Here are the major language changes in JDK7.
How do I split a space or comma-separated list?
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?
How can the following throw a NullPointerException?
Integer i = ...;
int j = i;
How do you just the @Deprecated annotation?
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
How do you write a Thread-Safe Singleton?
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
What's the difference between JavaScript and Java?
JavaScript is an object-oriented scripting language that allows you to create dynamic HTML pages, allowing you to process/validate input data and maintain data, usually within the browser. Origina...more
What are the differences between checked and unchecked exceptions?
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
What debugging tools exist for Java?
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.
What are the differences between Java 1.0, 1.1, 1.2, and 1.3?
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
What character escape sequences are available in Java?
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
What does the "final" modifier mean on a method parameter and when should I use it?
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
How can I do variable-length argument lists?
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