9
Have you ever created or encountered a self modifying code in Java? If yes, then please post the link or simply post the code.
Have you ever created or encountered a self modifying code in Java? If yes, then please post the link or simply post the code.
That should be difficult to realize. But you can create at runtime new classes and load them with a custom classloader. If you want to modify the code again, you have to reload the class.
From BCEL:
The Byte Code Engineering Library is intended to give users a convenient possibility to analyze, create, and manipulate (binary) Java class files (those ending with .class). Classes are represented by objects which contain all the symbolic information of the given class: methods, fields and byte code instructions, in particular.
You could always just use a dynamic language...