OVERRIDING METHOD USING INHERITANCE
If we're talking strictly only about using inheritance to override method on an existing application which you don't have access to the source code, @objlass is a bit ouf of the subject.
This is because if you create a new class that extend a new one and just override a method and put that in the classes folder of the running application, nothing will happen. This is considering you're not doing complex things lke decompiling and modifiying existing code.
However, if you have a DI Manager like Spring, you can change the class injected by editing the XML File, and so you're able to replace your own bean by the original one.
POINTCUT
Another kind of attacks too is not overriding methods, by adding cutpoints using aspect, again this can be done by the use of framework like Spring.
For the security of application, i have only heard that some project forbid any library adding the capability to add point cut using aspects.
The fact that in Java it could be easier to inject code don't really mean a lot, you can just consider that if someone was able to access to your application server, the server is corrupted.
OVERRIDING CLASS UING ENDOERSED FOLDER
Another way of hacking around would be to use the endorsed mechanism of Java, it's a specific place were all JAR that are put here take precedence over all others. So this means you can overwrite even type like Java.lang.String. Or instead of derivating a class to replace it or adding pointcut, you can just get the class (either source code or decompile .class) modify it, compiling it, put in a JAR and place it in the endorsed folder.
Note that apache Tomcat for instance possess already an "endorsed" folder used to override any library he needs internally to have the right version of the classes. you could just open one of those JARS and add your class within.
PROTECT AGAINST THOSE METHODS
How a sysadmin is supposed to detect this ? Well in fact i saw some pretty simple solution : a script that periodically (cron... :p) check if any file on the server (expect logs that are movd on /var/log or whatever) has changed and report it to the sysadmin if so.
Because whatever the way you're doing it, if you can't change the source code before it goes on the server, you will have to modify files and detect that is in fact pretty easy.
To even go further you could use compute md5 hashes (and still checking size of file!) of all your server's file and the running script (in case someone would try to add an external folder to the classpath).
Finally what i have say here is pretty simple to implements, there are probably even more smarter ways of doing this, however i don't have the necessary knowledge for this.
EDIT :
Thanks to @ojblass to point out there is a package named Tripwire that will watch files/directory for you and will execute the command you want when something occured.