Question about an extension or way to do it

Hi everyone, I have a question. You see that in Java code you can do modularization or encapsulation where the code is divided into multiple files, each one encapsulating specific functions or classes and then executing them.
My question is, is there any extension, something like that where you write your Java code and with the extension you put the code or file and send the data that you request and deliver the results.

Something like creating the function to use, saving it as a .java file and uploading the file to the creator.
Then, using the extension you can call that function, enter the data that the function requests and return the result.

:thinking: It would be something like creating an extension and having the functions in the extension