Your question is a bit to general but see this:
https://docs.mendix.com/howtogeneral/support/mendix-java-the-basics
and this:
If you are looking for step by step guide to write your own java actions:
https://docs.mendix.com/howto/logic-business-rules/extending-your-application-with-custom-java
See this article: Mendix extensibility, contains some links that may be useful.