How can I tell using reflection if a class is final

Suppose I have a class:

public final class Foo

and a reflected Class clz reference that refers to that class.

How can I tell (using clz) that Foo is final?

Jon Skeet
people
quotationmark

You use Class.getModifiers(), ideally using the Modifier class to interpret the return value in a readable way:

if (Modifier.isFinal(clz.getModifiers())

people

See more on this question at Stackoverflow