I am doing a project on sending & retrieving sms via java.pls tell me the source code as i am not able to use AT commands in program.

this is hardly a tutorial...

There is no way to send SMS from any language without special hardware.
Usually what you do is you contract a company that has the hardware to send the messages for you, and they provide you with an API which you can use to send them the messages to be sent.
You will then get charged per message and probably have to pay a subscription fee as well.

If you expect the volume to be very high it may be worth buying the hardware yourself and contracting directly with a mobile phone network to be allowed to send messages on their network.
You'll then be provided with the necessary APIs to control the hardware by the hardware vendor.
Again you're going to pay a fee per message and a subscription fee but these will be lower.

Thread moved out of tutorial forum. In the future, please post in the correct place :)

You can look at this link. It's a discussion about sending sms via java(j2me).

there's also an old article on onjava.com about it (posted about a year ago). Tells you some of the things to take into consideration.