From http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html:
\\Z The end of the input but for the fin
Like Eyal said, it works for find() but not for matches().
This actually makes sense. The \Z anchor itself actually does match the position right before the final eol terminator, but the regular expression as a whole does not match, because, as a whole, it needs to match the entire text being matched, and nothing matches the terminator. (The \Z matches the position right before the terminator, which is not the same thing.)
If you did "StackOverflow\n".matches("StackOverflow\\Z.*") you should be ok.