Jar stands for Java Archive file and it is used to compress and archive one or more files. It is equivalent to Zip file in Window operating system. A typical jar file contains Java class files in addition to source files as well as resource files, like images and properties. Let us see how to …
Java
Storing Application Data using Preferences API
Applications can now make use of the Java Preferences API for storing and retrieving Application related data. The location where the Data gets stored is implementation specific. Two levels of Preferences come into picture, one is the User Preferences for storing user information and the other is the System Preferences that deals with information common …
Threads Synchronization
Synchronization is done in order to protect a segment of code from being accessed by more than a single Thread at any particular instance of time. In Java, synchronization is achieved with the use of synchronized keyword. Synchronization can be applied to methods as well as to a block of code. also read: Java Tutorials …
Externalizable Interface in Java
Serialization is the process of giving persistence storage to Java objects so that they can be restored at a later time. Classes can be made persistent in Java by implementing the Serializable interface. Serializable is a marker interface meaning that it has no methods within it. Any Serializable class can be passed on to ObjectOutputStream.writeObject(object) …
Enhanced for-loop for User-defined objects
Enhanced For-loop is a new syntax for traversing over a collection of objects and it was introduced from Java 5.0. Let us see how Enhanced for-loop operates on user-defined Objects. The following example shows the syntax of using enhanced for-loop on a Collection object, also read: New Features in Java 5.0 Generics in Java 5.0 …
Template method Pattern – Design Patterns in Java/J2EE
A Template method pattern provides a skeleton for performing any sort of algorithm or an operation, and it allows the sub-classes to re-define part of the logic. Let us directly get into an example to clarify things in a much better manner. For example, if we wish to write a String Decorator class, which decorates …
Strategy Design Pattern In Java
Strategy design pattern falls under the category of Behavioural patterns. Assume that we have an object and its behavior is largely dependent on the state of its internal variables. Strategy pattern allows, object to behave in different ways depends on the internal state. Strategy pattern is defined in the book Gang of four is, Allows an …
Using the new Process Builder class
We all know how to execute programs from within a Java Application by making use of the Runtime Api. For example, assume that we want to launch the Internet Explorer browser within the Java code. Then the following code snippet will just do that, also read: Java Tutorials Java EE Tutorials Design Patterns Tutorials Java …