I see my error now, but wouldn't the AND operator be more appropriate since I want both?
From a high up, abstract perspective yes - however the manipulation here is actually bit manipulation on integers (very yucky which is why in the newer APIs it's been replaced by much nicer enums.) Before the days of enums it was common to use integers to represent constants, going up in powers of 2.
So option 1 might be 1, option 2, 2, option 3, 4, option 4, 8 and option 5 16.
The key with using the above options is when the number is represented in binary they all just have 1 "1" in different places:
(This is when you'll need to read up on bitwise manipulation a bit if you don't know it already!)
From the above, and now that you know a bit about bitwise manipulation you should be able to see why OR is the appropriate one to use here. Combining any 2 options with OR gives you both those options' 1's in the appropriate place. So combining options 1 and 3 would be:
However, if you used AND on any of the above options you'd just get 0 unless you used it with two OR combinations of course - but that's where it gets complicated!)
Bitwise manipulation is a very powerful thing when used in the right hands, however it's also potentially very confusing and doesn't really fit Java's philosophy - hence its replacement. The simple parts of it are relatively easy to understand, but these days it's really best avoided simply because it makes your code non intuitive to read (as you've just proven with the above completely valid question!)