def x=2def y=3if(x == y){ log.info "equal"}else{ log.info "not equal" // print out not equal}TestService s1 = new TestService()TestService s2 = new TestService()log.info s1.is(s2) // falses1=s2log.info s1.is(s2) // trueclass TestService{ }
Run result:
Tue Oct 06 21:04:38 CST 2015:INFO:not equalTue Oct 06 21:04:38 CST 2015:INFO:falseTue Oct 06 21:04:38 CST 2015:INFO:true