Home » Archives for Aldo Ziflaj

Author Archives: Aldo Ziflaj

Aldo Ziflaj
Aldo is a student of Computer Engineering and a programming addict. He spares his free time coding, whether mobile, web, or desktop programming. He is also one of the co-founders of Things Lab.

Java hashCode method Example

In this example we will discuss about hashCode() method. This is one of the methods that all objects have, since it is defined in the Object class, which is the base for all Java classes. This method’s functionality is to digest the properties of an object into a single, 32-bit integer value. The hashCode() method should return a unique value ...

Read More »

java.lang.IncompatibleClassChangeError – How to resolve Incompatible Class Change Error

In this example we will discuss about IncompatibleClassChangeError. This is thrown when an incompatible class change has occurred to some class definition. The definition of some class, on which the currently executing method depends, has since changed. It is normally thrown when a non-final field of a base class becomes static, or when the base class turns into an interface ...

Read More »

java.lang.AbstractMethodError – How to resolve Abstract Method Error

In this example we will discuss about AbstractMethodError. As you may have figured out, this is thrown when the application calls an abstract method. Normally, this error is caught by the compiler, it can only occur at run time if the definition of some class has incompatibly changed since the currently executing method was last compiled. The AbstractMethodError extends the ...

Read More »

Java do while example

There are four ways of looping with Java: for loops, for-each loops (since Java 1.5), while loops and the do-while loops. In this example, I will show how to use the do-while loops to repeat blocks of statements in Java.             do-while structure A do-while has the following base structure: do { // the code ...

Read More »

Java Get current date and time

There are a couple of ways to get the current time and date in Java. You may get the number of milliseconds since January 1, 1970, 00:00:00 GMT using System.currentTimeMillis() and calculate the time by yourself (a problem given to beginners, but too much work if you are developing something), you may use a library not included in the JDK ...

Read More »

Java Sorted List Example

In this example, I will show how to sort a java.util.List using methods of java.util.Collections class. SimpleSortExample Create a Java class called SimpleSortExample with the following source code.         package com.javacodegeeks.example; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class SimpleSortExample { public static void main(String[] args) { List list = new ArrayList(); for (int i=0;i<10;i++) { list.add((int) ...

Read More »

Java Collections Sort Example

In this example, I will show how to use the java.util.Collections class in order to perform sorting. The Collections class consists of static methods that return or operate on collections, such as Lists, Maps, Sets, etc. All the methods throw a NullPointerException if the collection(s) passed as a parameter is/are null. ArraySortExample Create a class named ArraySortExample with the following ...

Read More »