Q:

Java util pattern instance

while creating pattern objects like 
Pattern pattern1 = Pattern.compile("s", Pattern.CASE_INSENSITIVE | Pattern.DOTALL);

what is the logic behind passing multiple flags within a same parameter Pattern.CASE_INSENSITIVE | Pattern.DOTALL ?
Is there any name for this kind of declaration?
Can objects of any type be passed like this?

A:

No, objects cannot be passed like that.
This way is typically used to pass a variable amount of flags (true/false) to a method. The constant names are defined as int or long.
For example:
public static final int FLAG_A = 1;
public static final int FLAG_B = 2;
public static final int FLAG_C = 4;
public static final int FLAG_D = 8;

The values of the int constants are multiples of 2 so they can be combined with an logical or.
For example:
int myValue = FLAG_A | FLAG_C;

myValue contains now the information of FLAG_A and FLAG_C. To check if FLAG_A is set you can use:
if ((myValue & FLAG_A) == FLAG_A) {
  // flag a is set
}

