class Truth { boolean isTrue ( boolean assertion ) { if ( assertion != false ) { return assertion; } else { return assertion; } } } ... boolean doIt; Truth trutherizer = new Truth(); if ( trutherizer.isTrue( s.equals( t ) ) ) { doIt = true; } else { doIt = false; } // hint: all the above accomplishes is: doIt = s.equals( t );