The "go google it" tasks are annoying. I'm really lost even understanding the basics of this task. Google has not helped. Here is what I can figure out so far: 1. The modifiers in this context are things like "public" and "final" and stuff. So for it appears that line 15 in the code:
will get the "public" modifier for "public class Solution". It's an int, and while I'm not sure which int it is, I'm guessing that Modifier.PUBLIC is a constant with that int value. 2. Likewise, line 19:
int classModifiers = Solution.class.getModifiers();
gets the modifiers for the main method, which are "public" and "static". 3. And here's where my understanding fails. methodModifiers is not an array. It's a single int. So how can it be set equal to both the values of Modifier.PUBLIC and Modifier.STATIC? Nothing I've been able to find via Google explains this. For example, this link shows you how to get the value but it uses as its example the class where it has only a single modifier, which doesn't help at all to understand what happens when there is more than one modifier. 4. Oddly enough, I understand isModifierSet (except for how you are going to search one integer for multiple other integers) and getMainMethod methods just fine EDIT: Nevermind, someone on Discord explained how the getModifiers() method creates the integer. I think this task would probably be better if it mentioned that the integer uses the bit values within it as boolean flags representing the presence or absence of each type of modifier. Was able to easily solve the task once that part was explained.
int methodModifiers = getMainMethod().getModifiers();