concat() and + both add up strings. It looks same, but + do one more step. As seen below, + will create string builder and append the strings ...
Category ‧ Java
Error & Exception
Error is thrown by JVM in a scenario which is fatal and there is no way for the application program to recover from that error. Unchecked type: ...
Wait() vs. Sleep()
Wait and sleep method are completely different to each other wait() & notify(): method for inter thread communication. sleep(): introducing ...
Synchronized in Thread
While running multi-threads, there will be a significant problem when those threads try to use same resource. For example, multiple people try to ...
Primitive type vs. Reference type
Basic types for characters, different kinds of integers, and different kinds of floating point numbers (numbers with a decimal point), and also ...
System.nanoTime()
It will give you current time in nanoseconds(precise). Usually used for measuring performance of the code. To convert it to in seconds, divide it ...
Runnable vs. Thread
For both, you need to Override run() method to be created as a new thread by start() call. implements Runnable (preferred way) it shares the same ...
Types of Casting & instanceof
You must understand, that by casting you are not actually changing the object itself, you are just labeling it differently. Object of child class ...
Types of variables
Local variables are declared in methods, constructors, or blocks. Local variables are visible only within the declared method, constructor or ...
public vs. protected vs. private
public: A class, method, constructor, interface etc declared public can be accessed from any other class. protected: Variables, methods and ...