Triggers are procedures that get executed on certain database events. Not all databases support procedures, not all databases that support procedures also support triggers, and the types of events that are supported also vary from database to database.
Trigger procedures can be implemented in the procedural language(s) supported by the particular database; a few databases support Java as a procedural language, but most do not. The only product I know of that supports Java-based triggers is Oracle; I know the feature was available in Oracle 9i but I don't know if goes back to older versions. Here's a link to sample code for an Oracle Java-based trigger (free registration required):
http://www.oracle.com/technology/sample_code/tech/java/jsp/oracle9ijsp.html
(about the 6th example in the list).
You use triggers when you want a normal operation to have a side-effect; what that side-effect can be is only limited to the capabilities of the procedural language and your skill in it. You could for example have a trigger send email every time the data in a particular table is changed.