In this section, let us see how to recursively traverse over files and folders by making use of Java File API. Whether it is a folder or a file, both are represented as a java.io.File object. For example, consider the following code snippet, also read: Java Tutorials Java EE Tutorials Design Patterns Tutorials Java File …
Archives for August 2007
Querying Class Information at Runtime using Java Reflection API
Java Reflection API provides support for querying information about a class at run-time. This information includes the list of public as well as private members (methods) available for the class, the various public operations it supports etc. This section will guide you in making use of the Reflection API. Suppose we have the following test class …
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 …
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 …
HashCode and equals methods
HashTable, HashMap and HashSet are the Collection classes in java.util package that make use of hashing algorithm to store objects. In all these Collection classes except HashSet, objects are stored as key-value pairs. For the storage and the retrieval of any user-defined objects it is a good practice to override the following methods which is …
What is UDDI?
Introduction Welcome to the future of Internet-based application development and deployment. This article will give us an idea about Universal, Description, Discovery and Integration (UDDI). What is it ? Why it is an important in the future of Web services standards ? This article explains that UDDI is focused on sharing business information, making it …
Generics in Java 5.0
1) Introduction The feature of Generics in Java allows Applications to create classes and objects that can operate on any defined types. Programmers can now make use of the Generics feature for a much better code. There is no need for un-necessary casting when dealing with Objects in a Collection. This article provides a detailed …