Published by Zaheer
One of the welcome additions to Java language in Java 5 release is the static import declaration. static import works in the same way as traditional import declaration but it imports only the static members of a class.
Traditional import declaration looks like this
import java.util.*;
The above statement will import all the classes under java.util package.
The [...]
Share and Enjoy:
These icons link to social bookmarking sites where readers can share and discover new web pages.
. May 21, 2008
Filed under: Java
Tags: Java
Published by Zaheer
Even with many years of experience with programming in Java one cannot claim that he or she has mastered the language. What I found out with experience is that unless your job offers you diverse problems to solve, you are more likely to work on similar projects and hence may end up using the exact [...]
Share and Enjoy:
These icons link to social bookmarking sites where readers can share and discover new web pages.
. May 13, 2008
Filed under: Java
Tags: Better Programmer, Java BlackBelt, Quiz
Published by Zaheer
In Java you can find maximum or minimum value in a numeric array by looping through the array. Here is the code to do that.
public static int getMaxValue(int[] numbers){
int maxValue = numbers[0];
for(int i=1;i < numbers.length;i++){
if(numbers[i] > maxValue){
maxValue = numbers[i];
}
}
return maxValue;
}
public static [...]
Share and Enjoy:
These icons link to social bookmarking sites where readers can share and discover new web pages.
. Apr 13, 2008
Filed under: Java
Tags: Array, Java, maximum, minimum
Published by Zaheer
Reading properties file in Java is much easier than you might have thought. Following example illustrates one simple way of reading properties from a properties file.
Let’s say we need to read from myConfig.properties file.
The properties file has following entries.
Directory = C:/prodFiles/
NumberOfFiles = 25
Extension = java
Here is the class to read the values of these keys.
import [...]
Share and Enjoy:
These icons link to social bookmarking sites where readers can share and discover new web pages.
. Apr 08, 2008
Filed under: Java
Tags: Java
Published by Zaheer
Regular Expressions offer a concise and powerful search-and-replace mechanism.
They are patterns of characters used to perform search, extract or replace operations on the given text. Regular expressions can also be used to validate that the input conforms to a given format.
For example, we can use Regular Expression to check whether the user input [...]
Share and Enjoy:
These icons link to social bookmarking sites where readers can share and discover new web pages.
. Jan 10, 2008
Filed under: Java
Tags: Java, Phone number, RegEx, Regular Expression, SSN, utility, Validate email
Published by Zaheer
Code reusability is one of the many benefits of object oriented programming.
For example, in Java if you need to perform email validation in different classes, rather than writing validation code in each class you can create email validation method in one class and then call that method from other classes. Now you have only [...]
Share and Enjoy:
These icons link to social bookmarking sites where readers can share and discover new web pages.
. Dec 20, 2007
Filed under: Java
Tags: Java Utility, JDBC
Published by Zaheer
Vector class in java.util package is very easy to use. You can add objects of any type in a vector.
You don’t have to worry about declaring the size of the vector. You can just keep adding elements to your object and the vector will dynamically adjust the size. The vector will add elements one [...]
Share and Enjoy:
These icons link to social bookmarking sites where readers can share and discover new web pages.
. Nov 02, 2007
Filed under: Java
Tags: Java, Sort, Sorted Vector, Vector
Published by Zaheer
According to TIOBE Programming Community Index Java is still the #1 programming language.
TIOBE Index gives an indication of the popularity of a programming language and is updated monthly.
The ratings are calculated by counting hits of the most popular search engines.
Ruby moved up from 13th to 10th position.
Following is the list of top 10 [...]
Share and Enjoy:
These icons link to social bookmarking sites where readers can share and discover new web pages.
. Nov 01, 2007
Filed under: Java, Javascript
Tags: C, Java, Javascript, PERL, Programming Language, Python, ruby, TIOBE