Firstly languages such as Java do not offer such "consealing" feature cause they are not meant to be used that way. Secondly as masijade has rightly pointed out executables are not all safe. Though it requires good knowledge of such they can be broken too.
Read about obfuscation and what it does in order to make your code "unfriendly" or harder to understand to others. But this too isn't 100% safe rather quite far from it.
The only way to protect such source code is through the use of appropriate licenses that prohibit others from using your code in a way different from the one you intend them to use.
This has been well mentioned by the then moderator and current super mod s.o.s and masijade in a previous thread, you can find it if you want.