在Apex中,可以使用null
关键字来表示空值。下面是一些示例代码来演示如何输出null
值:
System.debug()
方法打印null
值:String myString = null;
System.debug(myString); // 输出为null
System.debug()
方法打印一个包含null
值的自定义对象:public class MyClass {
public String myString { get; set; }
}
MyClass myObject = new MyClass();
System.debug(myObject.myString); // 输出为null
null
值:String myString = null;
String result = 'The value is: ' + myString;
System.debug(result); // 输出为"The value is: null"
null
值:String myString = null;
if (myString == null) {
System.debug('The value is null');
} else {
System.debug('The value is not null');
}
根据以上代码示例,您可以根据您的实际需求来输出null
值。