Java Programming Tutorials

Java programming tutorials with many code examples!

Java Formattable example

Problem:

How to print Java object using custom format? Since Java 5 there’s Formattable interface exactly for that purpose. Here’s an example of how to use it.

Read More

Share with the World!

Bash script parameters

Problem:

How to process Bash script parameters? There are two ways – using while-case combo or with Bash getopts as we show in the following example.

Read More

Share with the World!

Bash case statement

Problem:

How to use Bash case statement to process complex conditionals? It’s most often used to process script parameters.

Read More

Share with the World!

Java find annotated classes

Problem:

How to find annotated classes in Java? JDK by itself doesn’t provide such mechanism, but there are libraries that can do that. One of them is Reflections, which is used in the following example.

Read More

Share with the World!

Spring find annotated classes

Problem:

How to find annotated classes using Spring and read metadata from them? Sometimes you may want to attach metadata to your classes using custom annotations. Here’s an example how you can leverage Spring‘s classpath scanning mechanism to do that.

Read More

Share with the World!

Java Reflection Generic Type

Problem:

How to get Java generic type parameter using reflection in runtime? Java doesn’t make it easy with type erasure, but it’s possible. See how.

Read More

Share with the World!

Bash array

Problem:

How to use Bash arrays? Bash is very flexible and allows to do funny things with arrays. Check out these cool Bash array examples.

Read More

Share with the World!
Pages:1...20212223242526...32