Activity 1.22.1.
public static boolean hasPermission(boolean isAdmin, boolean hasWriteAccess, boolean isAccountActive) { if (isAdmin == true) { return true; } if (hasWriteAccess == true) { return true; } if (isAccountActive == true) { return true; } return false; }- This code can be improved!
public static boolean hasPermission(boolean isAdmin, boolean hasWriteAccess, boolean isAccountActive) { return isAdmin == true || hasWriteAccess == true || isAccountActive ==true; }- Still can be improved!
public static boolean hasPermission(boolean isAdmin, boolean hasWriteAccess, boolean isAccountActive) { return isAdmin || hasWriteAccess || isAccountActive; }- Correct!
These code blocks are the ones you saw in the previous question and they all have the same functionality. Among these options which one is preferable?
