One of the most common bugs I’ve seen in Java programs in the use of == operator to compare two String objects. Most of the times the result may be accurate but it is not always guaranteed. We need to understand the difference between == and the Object.equals method.
SB Right – 3 Column
I’ve written about Java regular expression to validate email addresses before. Today I am sharing another Java regex to validate Gmail address. It is quite simple and self-explanatory.
Following simple Java program shows how to read input values and then print smallest and largest values. It reads the input from standard input using Scanner and then uses methods from Math class to determine the largest and smallest numbers entered by the user.
Although Java’s Arrays class has a built-in method to sort an array, it is important for good Java developers to know how to sort an array on their own. Bubble sort is the simplest sorting algorithm.
Here is a list of 10 commonly used Eclipse shortcuts for Java developers. Ctrl + Shift + T: Open a type (e.g.; a class, an interface) without browsing through list of packages Ctrl + Shift + R: Open any file quickly without browsing for it in the Package Explorer Ctrl + O: Go directly to […]
Joomla is a wonderful platform to publish websites. With readily available templates you can have your website up and running in no time. Sometimes though you may need to direct your visitors to a different page than your regular home page, for instance you may want to direct all the visitors to a promotion page […]
Recently a reader contacted me with a question about sorting numbers in Java. After sorting the number the program then needs to print the largest and smallest values. I have written a post earlier that shows one way of finding largest and smallest numbers. That approach used Arrays but the reader wanted to find largest […]
Many Java beginners find it difficult to differentiate between == operator and the “equals()” method when comparing String variables in Java. They assume that both operations perform the same function and either one can be used to compare two string variables. I have even seen many experienced programmers committing the mistake of using “==” to […]