The answer to your question: yes, you can replace the class file, but it is somewhat complicated, because you must be sure that no other dependencies have changed.
For example, if the class you are compiling involves changing the signatures of the method methods that are used in other classes, you also need to replace them. As long as the signature methods of the public, secure, or standard methods are not changed, you should be fine.
, , , .
public MyObject getObject(MyObject2 mySecondObject)
vs
public MyObject getObject(int a, int b, int c)
, , , , , , .
, , , , , . , , , , , , .
, .