ThreadLocal in Java

java-thumbnail

ThreadLocal is one of the rarely used class in Java. I found it is one of the powerful class in Java on multi-threaded programming. In multi threaded program generally we use session object to track the current users information. also read: Java Tutorials Java EE Tutorials Design Patterns Tutorials Java File IO Tutorials These information […]

Why multiple inheritance is not allowed in Java?

java-thumbnail

For long time I had a question “why Sun introduced Interface concept instead of C++ style of multiple inheritance?“. I did googling but many articles and forums talks about difference between abstract class and Interface not why Interface concept required in Java. After extensive search and analysis I came to know the reason behind the […]

Call Java Oracle Functions From Java program

java-thumbnail

Call Java Oracle Functions From Java program Beginning with version 8i, the Oracle database includes a fully functional Java Virtual Machine, Oracle JVM. Out of this close relationship between Oracle and Java emerges an important technology for Oracle developers: Java stored procedures. With Java stored procedures, developers have the ability to harness the power of […]

Comparing Objects in Java

java-thumbnail

Comparing Objects in Java In Java comparing two value object is not straight forward. Here we will see how we can compare two value objects in Java. For that first we will create a value object called “MyValueObject”. This value object contains two properties. firstName lastName. Both the properties are of type string. also read: […]

Passing arguments and properties from command line

java-thumbnail

Arguments and properties can be passed to a java application from command line. In this techical tip, let us see how to pass arguments as well as properties from command line. also read: Java Tutorials Java EE Tutorials Design Patterns Tutorials Java File IO Tutorials Passing arguments from command line The syntax to pass arguments […]

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, […]

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 […]