如果我尝试访问空值,而 Objective C 没有,为什么 Java 经常抛出空指针异常?
爪哇:
public class SubscribeEmailActivity {
String status;
public static void main(String[] args){
if(Status.equals(null)||status.equals(""){
// i am getting error here
}
}
}
目标 C:
//in .h file
NSString *exp;
//in .m file
if ([exp isEqualToString:NULL] ||[exp isEqualToString:@""])
{
// i am not getting any error
}