Compare modifiers

  • 12
  • Locked
Implement the logic of the isModifierSet method, which checks whether the passed allModifiers argument has a specific modifier set (specificModifier). P.S. Before implementing the task, take a look at the Modifier class and the implementation of isPublic, isStatic, and so on.
You can't complete this task, because you're not signed in.
Comments (1)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Brandon Waites
Level 25 , Cincinnati, United States
15 March, 19:12
Hey CodeGym I'm not sure if it was intentional that my solution passed for the Compare Modifiers task, especially after looking at some of the more advanced (or rather, relevant judging by our earlier lessons) solutions, but I would like to point out that it passed verification just by using this logic:
public static boolean isModifierSet(int allModifiers, int specificModifier) {
    	if (allModifiers - specificModifier >= 0) {
    		return true;
    	}
        return false;
    }