This walkthrough from ESRI teaches how to create a custom command by inheriting from the ESRI BaseCommand class. Inheriting the BaseCommand allows you to create commands more quickly and simple than directly implementing the ICommand interface in ESRI.ArcGIS.SystemUI.
Here is a link to start with. If you are new to application development in .NET environment, you can take this sample as your first step. The walkthrough explains in both VB.NET and C# languages.
If anyone has any doubts or require help on this, please do write me.
You may ask wheather we can create ESRI command/tool using Java?. The answer is YES, but not in a direct way. We have to compile jar to dll using other tools (eg. J-Integra). If you are serious java developer you can watch this ESRI thread for the possible approach.