Here is my class, where i am concatenating two string.
String concatenate with null using + operator execute smoothly but throws NullPointerException with concate() method.
public class Test {
public static void main(String[] args) {
String str="abc";
String strNull=null;
System.out.println(strNull+str);
str.concat(strNull);
}
}
can anybody tell me the reason behind it ??