範例

public static void main( String[] args ) {
Object object;
//....
if (object.getResult() != null) {
System.out.println(object.getResult());
}
}

解決方案
    請利用一個變數來儲存方法呼叫的結果

public static void main( String[] args ) {
Object object;
Object result = object.getResult();
if (result != null) {
System.out.println(result);
}
}