Here is my class, where i am concatenating two string.
String concatenate with null
using + operator execute smoothly but throws NullPointerException
Actual implementation of concate method is like this . this method need an object of type String as a parameter and if argument is null then it throws Null Pointer Exp.
public String concat(String paramString)
{
int i = paramString.length();
if (i == 0) {
return this;
}
int j = this.value.length;
char[] arrayOfChar = Arrays.copyOf(this.value, j + i);
paramString.getChars(arrayOfChar, j);
return new String(arrayOfChar, true);
}