Posts Tagged ‘Java 5

Checking and Reading Contents of a Directory in Java

Many applications require to check if the file being accessed is really a file or a directory. Also if it is a directory then you would need to traverse through the contents of directory. Here is the code snippet that shows how to do it. In addition to this you may have to handle exceptions. [...]

Java

Decorative Programming using Annotations

Annotation is not a new feature getting introduced in Java 5, but in this release Java is trying to explore the power of this feature. If we look at the open source product stack adapting to Java 5, then this is the feature what has changed most of the products considerably. It has begun a [...]

Java, Tech Notes

Static Imports in Java 5

Static keyword is used to allow access to an attribute/ a method or a class without creating instance of it. (Some of you may argue that this is not object oriented way, but we leave that discussion aside for now.) We use static for those elements which do not change from instance to instance of [...]

Java, Tech Notes

Varargs in Java 5

Varargs means variable arguments, something really different from normal Java language syntax. Normally, we define method signature to offer a contract to the callers of that method by restricting number and type of input parameters, return data type and exceptions thrown. Using vararg feature, we can overcome this restriction partially and make the signature dynamic. [...]

Java, Tech Notes

Enums in Java 5 with Code Examples

Enumerations already existed in other languages like C, C++, SmallTalk etc. Enums are used primarily to handle a collection of logically grouped constants. In Java, for ages we have been handling constants (number constants here) through separate Java files, sometimes by encapsulating those in relevant POJOs, and even using a wrong design style of implementing [...]

Java, Tech Notes

Autoboxing in Java 5

Autoboxing feature in Java 5 is to make code look neater and cleaner. Autoboxing, as name suggests, does something automatically. It converts data types from one form to other automatically. This does not apply to any data type but to some selected data types which allow this conversion (generally without losing out any information). Using [...]

Java, Tech Notes

For Each Loop in Java 5

Compared to other changes in Java 5, this is a smaller change. The idea behind this change is to improve how we access collection elements and arrays. In this article, we see how the loop has improved over a period of time through different releases of Java. What are the advantages we get with new [...]

Java, Tech Notes

Generics in Java 5 Explained

Generics, is an important feature introduced in Java 5. Java introduced many other features, but this is the only feature which adds flexibility to strongly type data types. In this article, we try to find answers to these questions: Why do we need this feature? What is this feature? What are different scenarios in usage [...]

Java, Tech Notes

Java 5 Tutorial

Java 5 has introduced many new features to take this platform to a new level with 15 component JSRs and around 100 other updates. These changes definitely bring considerable shift in usage of this technology. Java intends to address following important concerns through this ‘Tiger’ release.

Ease of Development
Scalability and Performance
Monitoring and Manageability
[...]

Java, Tech Notes