What is scoped memory in JVM?

Normally when we program in Java we don’t much care for the lifetime of objects we create or use. Objects are created and deleted and the programmer is pretty much content. The JVM determines where and when objects are deallocated and the garbage collector may decide at any time what objects to collect.

Unfortunately while […]

What is the difference between notify and notifyAll methods?

Java has one peculiarity in which every object can be used as a synchronization primitive (monitor). We use the `synchronized(Object)` keyword (or a synchronized method which implicitly synchronizes on `this` variable).

All threads that wait on some object are blocked until one becomes notified that he can become unlocked.

notify method
We can notify one thread using the […]

Allow highlighting of Images in your android app

Android provides very important features under android.graphics package that let you draw directly to the screen and modify images using filters.

To highlight an image in Android, you can use this package and apply blur filter on your image and get another image that seems to be highlighted. This requires a little bit of calculation as […]

How can we read and write to a properties file using Java application?

What is a property file
Java comes out of the box with a mechanism to store configure options of an application such as config files, or localizations of strings namely properties.

Properties are files (usually with the `.properties` extension) with a very simple syntax:

# Comments start with either an hash (#) symbol or a
! bang (!) symbol
# […]

What is the purpose of ThreadLocal in Java

Java provides one convenient mechanism for multi-threading – thread local variables. As the name implies thread local variables are local to threads (in contrast to variables local to a class, method etc.)

What that means is that each thread sees its own version of the variable which is initialized and may be modified independently by each […]

How to control Airplane mode using Java code in android

In an Android phone, Airplane mode is used when the user wants to cut off all communications via radio signals propagated by smart phone. There is a menu provided to enable or disable this mode in latest Android phones. However to do this by using java code in Android application is also possible.

Android provides […]

How to use SQLite Database in android applications

SQLite is an open-source database and it stores data in text file on the system. Android provides great support for SQLite. It doesn’t require creating connection and it supports all kind of relational database operations.

Android provides and API for managing your SQLite databases under android.database.sqlite package. This package provides a class SQLiteOpenHelper.java which has […]

What are the various modifiers in Java

In Java Programming Language, modifiers manages the operation of Class, Methods, and Variables and also play vital role in handling all the java operations.

Thus modifiers are said to be Java keywords which are used in class, methods and variable declaration. Basically Java Programming Language facilitates two types of modifiers.

Access Modifiers or Visibility Modifiers.

Non Access Modifiers […]

How to clear user data in android

Clearing Application’s stored data on device is sometimes required by user. This option is provided by Android system in Application manager. From application manager the user can clear data for all applications.

Clearing data can be useful when user wants to use application from start and wants to delete all previous data. Clearing data […]

What is the purpose of CountDownLatch in Java 5?

Synchronization and CountDownLatch
`java.util.concurrent.CountDownLatch` in Java is a class that provides an useful synchronization mechanism. A `CountDownLatch` must be initialized with a count like so:

Threads may await on the `CountDownLatch` by using the `await()` method. All threads awaiting on the `CountDownLatch` will block until the latch counts down to 0. Threads awaiting on a `CountDownLatch` may […]


Enter your email address:

Delivered by FeedBurner

Java ExperienceA place for all type of Java web tutorials2014