
Char Is Not Int
The code below expects that you can create a character from a number. It’s already bad technically: int is signed, while char is unsigned (a char is just 16 bits

The code below expects that you can create a character from a number. It’s already bad technically: int is signed, while char is unsigned (a char is just 16 bits

After successive development exposure, we understand the memory needs of our application. Java allows you to start the application with memory specifications as required and the application is bound to

Heap Dumps are vital artifacts to diagnose memory-related problems such as memory leaks, Garbage Collection problems, and java.lang.OutOfMemoryError. They are also vital artifacts to optimize memory usage as well. In

/*** @returns [1]: Location, [2]: Customer, [3]: Incident*/Object[] getDetails(int id) {… This sort of passing back values from a method is error prone; it is recommended to declare a small

An important usage would be to find the compiler that is available in the current context. The method getSystemJavaCompiler() returns the Java compiler if available or else returns null. import javax.tools.*;public

Calendar calendar = new GregorianCalendar();calendar.setTime(date);calendar.set(Calendar.HOUR_OF_DAY, 0);calendar.set(Calendar.MINUTE, 0);calendar.set(Calendar.SECOND, 0);Date startOfDay = calendar.getTime(); The code above calculates the start of the day (0h00). The first mistake is the missing millisecond field of

There are times when we might be interested in knowing the memory usage of our application. The Runtime class in Java has various methods to help with that. This data

The code below eliminates spaces at the beginning or end of a name entered by the user, it tries to remove the spaces inside the setter method of a bean.

For effective usage of variables in loops, it is advised to create variables outside of loops and use them in the loops. This helps save lot of memory and makes