Many Java programmers are only familiar with having the public static void main in a class to start the application. However, there are other places where we can define this
They say that when an Exception occurs, the finally clause, if available, will always execute no matter except for one thing.
This post shows how to access the Spring ApplicationContext object in JUnit tests. Now, why would we want to do that? Well, sometimes, we need to work directly with the
This post shows how to remove an XML element based on some parameters in Java using XSLT. We mean parameters for the Transformer object and let XSLT work its magic
This post demonstrates how to use Java JDBC API with try-with-resources database resources in the following order – ResultSet, Statement, and Connection. The try-with-resources is a new exception handling mechanism
Java classes and their variables and methods can use access modifiers – private, public, protected, and package-level (no keyword). These access modifiers set the classes’ visibility, constructors, and instance or
Given a simple Java application with a Thread object, we want to block the main thread until the Thread object completes its execution. The main thread is where the Thread object is created and its start method invoked.
When we have applications that call native commands via java.lang.Runtime.exec(), be wary of the invocations. It could potentially output an overwhelmingly large number of texts to the standard output—for example, the
JPoller is a general purpose Java component to poll directories and asynchronously notify client code of incoming files.