recent posts related to java, jdbc, spring, etc.

Java enum examples/tutorial

Java enum FAQ: Can you share some Java enum examples, such as how to declare a Java enum, and how to use a Java enum in a for loop, if then statement, and Java switch statement?

As described in Sun's Java documentation, a Java enum "is a type whose fields consist of a fixed set of constants ... you should use enum types any time you need to represent a fixed set of constants." Let's take a look at some Java enum examples to see how this works.

Converting a Scala class file to decompiled Java source code

As a Scala newbie, I'm curious about how the process of converting a Scala class back to Java source code works. What I really want to see is how my Scala source code is converted to Java source code. Besides plain old curiosity, I think that understanding more about how Scala works can also be very important to my understanding of Scala (such as the apply() method, and so on).

A simple Java Generics example class

To take a break from a project I was working on yesterday I gave my brain a little exercise to see if I could remember how to create a Java class that used the Java 5 Generics magic. Since I've used Scala a lot recently, I decided to create a Java version of the Scala Tuple class.

The Tuple class simply stores two values, which are often key/value pairs. Beginning with the end in mind, here's how you typically use a Tuple:

Syndicate content