Generation of Random Numbers

java-thumbnail

Random numbers in java can be generated either by using the Random class in java.util package or by using the random() method in the Math class in java.lang package. also read: Java Tutorials Java EE Tutorials Design Patterns Tutorials Java File IO Tutorials In both these approaches, we only get a pseudo random number and […]

Downloading Content from the Internet

java-thumbnail

Let us write a Simple Downloader in this techincal tip by making use of the classes with java.net package. URL stands for Uniform Resource Locator and it is used to locate a resource in the Web in a standard fashion. A resource in the Web can be anything; it can be as simple as Html […]

Creating user defined exceptions

java-thumbnail

Though Java provides an extensive set of in-built exceptions, there are cases in which we may need to define our own exceptions in order to handle the various application specific errors that we might encounter. also read: Java Tutorials Java EE Tutorials Design Patterns Tutorials Java File IO Tutorials While defining an user defined exception, […]

Copying File Contents using FileChannel

java-thumbnail

In this technical tip, let us see an easy way of achieving file copy using File Channels. File Channels are part of Java New I/O Packages. A file can be viewed as a sequence of bytes. The various Buffer classes in New I/O Packages serve as a container for manipulating the primitive byte contents. It […]

What is Hibernate Caching?

hibernate_orm

1. Introduction While working with Hibernate web applications we will face so many problems in its performance due to database traffic. That to when the database traffic is very heavy . Actually hibernate is well used just because of its high performance only. So some techniques are necessary to maintain its performance. Hibernate Caching is […]

Logging Messages using Java Logging API

java-thumbnail

The Logging API in Java enables Applications to log messages of some level which will be very useful for debugging purpose. Say, if a system fails for some reasons, then the reason can be easily traced out by looking at the information available in the log file. In this section, let us see an overview […]

Working with Virtual Proxy Pattern

java-thumbnail

Application is often a collection of components and in most of the situations it may be the case that a component should be loaded until it is first accessed by the Client. Reasons may be that the component in consideration may be using most of the system resources. For example, consider the Microsoft Word Application […]

Making use of the Properties class

java-thumbnail

In this section, let us make use of the Properties class for storing and loading application related configuration values as well as other user information. It is also possible to query or modify the various System properties using this class. For example, the following code tries to get all the properties that are available for […]

Parsing Input using Scanner

java-thumbnail

A Scanner object can be used to read text input from a number of sources. The input source can be a file, an input stream or even from a string. It internally uses the Regular Expression Api for parsing and getting the input. Let us see a simple example to parse a String object, also […]

Parsing XML Documents using SAX

xml

Xml Parsers are used to parse and extract information from Xml Documents. The most commonly used Xml Parsers are Simple API for Xml Parsing and Document Object Model. SAX Parsers are preferred when the size of the Xml Document is comparatively large and the application doesn’t wish to store and reuse the Xml information in […]