category

home / developersection / category

Annotations in Java: Declaring Annotations (Part-1)
java 28-May-2016
Annotations in Java: Declaring Annotations (Part-1)

Having seen the built-in simple annotations in the previous posts, it is time now to create our own annotations. Why would we create our own annotations?

Annotations in Java: @Override and @SuppressWarning
java 28-May-2016
Annotations in Java: @Override and @SuppressWarning

In the previous posts, we have learnt what annotations are and why we use these annotations in java program codes. We have learnt the use and demonstration of @Deprecated annotation.

Annotations in Java: @Deprecated
java 28-May-2016
Annotations in Java: @Deprecated

The Java API over the years has deprecated quite a few classes and methods. This means new methods and classes have been added that provide a better way to achieve the same task;

Autoboxing and Unboxing in Java
java 28-May-2016
Autoboxing and Unboxing in Java

In the previous posts, we have just seen the use of type wrappers in wrapping the primitive data types. Beginning in J2SE 5.0, we will not have to explicitly perform such wrapping. The wrapping/unwrapping is now implicit and automatic.

Wrapper Classes: A Few Additions in J2SE 5.0 (Part-2)
java 28-May-2016
Wrapper Classes: A Few Additions in J2SE 5.0 (Part-2)

The Character class that wraps a char data type provides several utility methods to operate on character data. We can test whether the given character is a digit, a letter, a lowercase character, and so on.

Wrapper Classes: A Few Additions in J2SE 5.0 (Part-1)
java 28-May-2016
Wrapper Classes: A Few Additions in J2SE 5.0 (Part-1)

The type wrapper classes were provided in Java libraries since its first release. J2SE 5.0 made several useful additions to its methods. For example, the Integer class now provides methods for bit manipulations.

Wrapper Classes: Constructors and Methods
java 27-May-2016
Wrapper Classes: Constructors and Methods

To wrap a primitive type into one of these classes, we use the provided class constructor. Generally, each of these classes provides two constructors:

Java Enumerations: Serializing enum Types
java 26-May-2016
Java Enumerations: Serializing enum Types

Earlier we learned that objects of the enum type can be serialized and compared to each other.

Java Enumerations: Attaching Methods to Enumerations
java 26-May-2016
Java Enumerations: Attaching Methods to Enumerations

Suppose we want to convert a user-specified weight in pounds to a different unit of measure, such as kilograms, carats, or ounces.

Java Enumerations: Adding Properties to an Enumeration
java 26-May-2016
Java Enumerations: Adding Properties to an Enumeration

To add a property to an enumeration constant, we would need to define its constructor.

Java Enumerations: Days of the  Week Example
java 26-May-2016
Java Enumerations: Days of the Week Example

In the previous post, we have seen why we need Enums in java, we have seen how to create integer patterns for Enumerations.

Java Enumerations: Why we need Enums?
java 26-May-2016
Java Enumerations: Why we need Enums?

Oftentimes, we need a fixed set of constants in our application. Examples might include the days of the week and the colors in a rainbow.