This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Welcome to the JavaRanch. It depends on your jurisdiction, but in the United States, copyright is automatic. It would be a good idea to place notices in obvious places like the source code and a splash screen that states "Copyright (c) 200x <your name or your company>" to make your claim obvious. Of course, copyright is worthless without the time, money and lawyers to find infringers and bring them to court. Wiki on Copyright
To be precise, the best way to establish a copyright is with the following type of notice:
Copyright (C) 2008, Myself All Rights Reserved.
Replace "Myself" with your name, company name, or whoever.
You can go one step further and register the work with national copyright offices, but a declared notice is considered sufficient pretty much anywhere. "All Rights Reserved" was, and may still be needed to get full copyright protection in some places, notably Uruguay.
Note that registering a copyright generally gives you the right to sue over violations.
As Joe Ess has noted, any work you produce is automatically copyrighted in the USA. The rest is just icing on the cake. For best results on a software project, I recommend placing the notice on the source code, the splash screen, documentation (note that BOTH program and documentation carry copyrights!), any other place where people might need to be reminded, and in some sort of readme file in the project root directory - if you have a license information file, that's an excellent place, since the copyright and licensing are related matters. But any place someone can find it easily will do.
This should not be construed as legal advice - just as a general guideline. Actual copy rights are subject to differences depending on time and locale. Currently most countries subscribe to the Universal Copyright Convention and/or the Berne Convention, so adhering to their requirements will give you the best international protection. If you're really serious, also check the applicable laws for the countries of origin and use for your copyrighted works.
An IDE is no substitute for an Intelligent Developer.